Create two objects p and q and generate 10 random numbers

Assignment Help Programming Languages
Reference no: EM13779925

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 <algorithm> 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

Reference no: EM13779925

Questions Cloud

Create a one-page flyer that contains advertise : Create a one-page flyer that contains advertise. A text description about the activities based on the fitness activities detailed above.
Recent ethical obligations confronting public administrators : In 3-4 pages, discuss public interest, administrative responsibility and some of the recent ethical obligations confronting public administrators in their day to day decision making.
How does the theory address the problem of crime : How does the theory address the problem of crime? How are cultural influences on crime integrated into the theory? What solutions for the individual, family, community, and society does the theory suggest
Just-in-time materials management : Discuss your thoughts about just-in-time materials management, its value, shortcomings, and provide an example of where it may be implemented. Below is a brief discussion of JIT vs. MRP. Two approaches have had a major impact on inventory management:..
Create two objects p and q and generate 10 random numbers : 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 12b. Generate 10 random numbers
Transmitted illnesses and the social justice framework : Consider general access to care, maintenance of health and prevention of illness, and treatment of illness. Briefly compare differences in scope (the extent and relevance to the issue of social justice) of two the conditions, obesity and HIV/AIDS...
Impact of legislation on organizations : Your research paper should be no more than three (3) full pages, double spaced, 1-inch margins, in New Times Roman 12-pitch font, with a cover page (name, course number, date, title of paper) and a reference page.
Determine the activities of the intelligence community : There are steps that should be taken that can produce results with minimum errors. These steps, known as the intelligence cycle, include planning, collection, processing, analysis, and dissemination. The intelligence cycle is used to determine t..
Neurological disorders that can occur in development : Write 500 word essay on 2 different neurological disorders that can occur in development and how it affects development, In addition, discuss what research suggests about the effects of spiritual disciplines (prayer, meditation) on neurobiology A..

Reviews

Write a Review

Programming Languages Questions & Answers

  Explain and identify object-oriented concepts

Explain and identify object-oriented concepts and identify object-oriented classes and also the attributes and methods they contain.

  Write ipo charts for program contains four value functions

Add new C++ source file to project. Name the source file Ch9AppE05. Use Ipo charts you created in step a to code program. Display gross pay with a dollar sign and two decimal places.

  Write program to will read unspecified number of positive

Write a program which will read the unspecified number of positive numbers from keyboard and determine the sum and average of these numbers.

  Do ides help or hinder newbies learning to code

Do IDEs help or hinder newbies learning to code? Should they first be exposed to a text editor without a lot of fancy features to learn how to set things up

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Write a prolog relation that returns a list

Write another relation (anything you want) that does something not performed above. Explain what your relation does.

  Write program that prompts user to specify people and car

Write a C++ program that prompts the user to specify people and cars. Store them in a vector and a vector .

  Design getter and setter and constructor methods

User must have option to draw new shape at different location and keep the existing shape. Design all the getter and setter & constructor methods for each class.

  Program to compute grade point average

Write a program that uses such a file to calculate your grade point average(GPA). A GPA is based on a scale from 5, where A is 4, B is 3, C is 2, D is 1 and F is 0.

  Research on programmer defined functions

Write a 2 page research paper (excluding title and reference pages) on programmer-defined functions. Explain the concepts discussed in the textbook using at least an example not included in the textbook.

  Write recursive function to take list head pointer

Write down the recursive function which takes list head pointer as parameter and returns largest value in linked list. Recall that xy = (xy/2)2 if y is even. Use this to write function which calculates xy.

  Write pseudocode

Write pseudocode that represents the abstract functions of the enqueue and dequeue operations. Define and explain any supplementary information needed by your pseudocode.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd