Create two objects p and q in object p the array a is type


1. Use the following class declarations template < class T, int n>

class TWO

{private: T aln];

public: void ReadData(); // read data into array a

void DisplayData(); //display array a

void SortArray(); //sort array a

-TWO() { }

};

a. Create Two objects P and Q. in object P the array a is type int and size 10, in Q array a is string type and size 12

b. Generate 10 random numbers <20 and store them in array a of object P. Store the name of the month from Dec to Jan in array a of object Q

c. Display the unsorted array a of P and Q

d. Make the SortArray to use the sort member of library to sort the array a of
each object

e. Display the sorted array a of objects P and Q

2. Use the "STACKLlB.h" library to do the following

a. Read a sentence and display it in reverse order

b. Read an integer number <100 and convert it to a new base 2, 8, or 16 Sample I/O

Enter a sentence: Happy Thanksgiving Sentence in reverse order is gnivigsknahTyppaH

Enter an integer number <100: 58

Enter a new base(2,8,16): 2

58 at base 2 is 111010

Try base 8 and 16. Paste all out puts at the end of your program

NOTE 50 at base 8 is 72, and at base 16 is 3A

3. Given two points A(x1, y1) and B(x2,y2), then

A(xl,y1) + B(x2,y2) = (x1+x2, y1+y2)
A(x1,y1) - B(x2,y2) = (x1-x2, y1-y2) K*A(x1,y1) = (k*x1,k* y1)

Write a program to overload the + , -, * operators to add , subtract two points , and multiply a point by constant k. At the end find the distance between the two points.

Sample I/O
Enter the coordinates of point A: 3 4
Enter the coordinates of point B: 5 7
A(2,3) + B(5,7) = C(7, 10)
A(2,3) - B(5,7) = C(-3, -4)
Enter a constant: 4
4*A(2,3)= C(8,12)
The distance from A(2,3) to B(5,7) is xx.xx

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Create two objects p and q in object p the array a is type
Reference No:- TGS01060356

Expected delivery within 24 Hours