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

  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,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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