Write the complete description of all functions

Assignment Help C/C++ Programming
Reference no: EM13754631

1. Use the following class declarations. Write the complete description of all functions so that the program creates the following I/O

class POINT

{ private: int x, y;

public: /1 constructor to set x,y of each vertex to ZERO

POINT ();

// member to read x and y coordinate of each vertex

void ReadData(char vertex);

// display the ( x, y) of a given vertex

void Display( char vertex);

// friend to compute the distance between vertices p(x,y) and q(x,y)

friend float Distance(POINT p, POINT q);

// Compute and display the perimeter of ABCD

friend void DisplayPerimeter( float AB, float AC, float CD, float BD); //destructor to release all memory used by objects in the program

˜Two();

};

Sample I/O

For rectangle ABCD:

Enter the x and y coordinates of vertex A: 10 7

Enter the x and y coordinates of vertex B: 20 7

Enter the x and y coordinates of vertex C: 10 2

Enter the x and y coordinates of vertex D: 20 2

              A(10.00,7.00)------------------------ B(20.00,7.00)

              C(10.00,2.00)------------------------- D(20.00,2.00)

AB= 10.00

AC=5.00

CD=10.00

BD=5.00

Perimeter =30.00

Hint. Part of the main function should look like this

Int rnain()

{ POINT A, B, C, D; //create 4 objects and initialize their x and y

cout<<"For the rectangle ABCD:\n";

A.ReadData('A');

//draw  the  rectangle

A. Displayr('A'); cout<<"...............................";B.Display('B'); cout«endl;

//compute  the  length  of  each  side

float  AB = Distance (A,B); cout <<"\t AB=" <<AB<< endl;

//compute and display perimeter

DisplayPerimeter(AB, AC, CD, BD);

//terminate program

return 0;

}

class Two

{

private: int age[5];

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

// friend to return the average of data in array age of object p friend int FindAverage (TWO p );

//member to find and return the max and min age

void FindMaxMin( int& maxAge, int& minAge); //display ages>age average

Void DisplayAboveAve( int ageAve);

//display the max and min ages

void DisplayMaxMinAge(int maxAge, int minAge);

//release all memory used by objects

~TWO() {}

};

Write all members and friends after the main

a. Write the main to produce the given I/O

3. Given the following class declarations

class THREE

{ private: int a[5];

public: void CopyData(string fname) ; //copy data from file into array a

void SortArray (); //sort the array a of the object activated this member

void DisplayArray();//display the array a of the object activated this member

~THREE();

};

And the following three files. (a) convert the class to a class template to receive the type and the size of array a. Describe all members after class. (b) we want to display the sorted form of each file by (i) coping data from the file into array a, 90 sort array a, 9iii) display the sorted form of array a

Filel.txt

25 50 13 77 9

File2.txt

Mary John Adam Bill Jack

File3.txt

C OR NE



 

Output



This is the sorted form of Filel.txt

9 13 25 50 77

This is the sorted form of File2.txt

Adam..... ........ ........ .........

This is the sorted form of File3.txt C E .....

 

Reference no: EM13754631

Questions Cloud

Determine how rootkits can be used : Determine how rootkits can be used as an alternative for data hiding and explicate why they can be used for this purpose. Describe the processes and tools used by an investigator in determining whether signs of steganography are present in a given ..
What role did the human figure play in the art work : What role did the human figure play in the art work and culture of each era? Include how these aspects are supported by specific formal or thematic aspects of each work.
Stress concentration factor : Define the following: a) stress concentration factor b) yield strength c) ultimate strength d) modulus of elasticity
Describe cloud computing and its pros and cons : Business case: Analyze the following business case and provide your recommendations. Describe cloud computing and its pros and cons in three paragraphs
Write the complete description of all functions : Use the following class declarations. Write the complete description of all functions so that the program creates the following I/O
What city is in the seat os virginias state government : What city is in the seat os Virginia's state government?
According to act-utilitarians : The only Wall Street analyst who did not recommend Enron stock was a)promoted for being the only one to give the right prediction. b)a whistle blower who made Enron's fraud public. c)bribed into changing his recommendation for $3 million in Enron sto..
How did the spread of the muslim empire affect trade : How did the spread of the muslim empire affect trade? Think about trade networks that already existed, the arabic language, and currency and economic systems.
How did the spread of islam influence literature : How did the spread of Islam influence literature, the arts, and architecture? Think about the literary tradition that already existed, ways of praising allah, and Islamic belief about art.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a program to create 100 real random numbers

Write a program to create 100 real random numbers and store it into a 1-D array.

  Write a c program that reads in five numbers

Q1. (Bar Chart /Histogram printing) Write a C program that reads in five numbers (each between 1 and 30). For each number read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the numb..

  Provide an avenue for users to enter test data

Suggest an application system which is able to perform some arithmetic computations, like commission system, encryption system, timer system, etc, from anyone of the following industry.

  Random permutations

Write a program in C++ that gives a prompt to the users, asking for an integer M.It then prints out a M different random permutations, one on each of M lines, of the numbers 1, 2, ... , 10, separated by spaces or tabs.

  Write c++ program that reads in the average monthly rainfall

Write a C++ program that reads in the average monthly rainfall for a city for each month of the year and then reads in the actual monthly rainfall for each of the previous 12 months

  Businesspartner class that contains a first name

Create a BusinessPartner class that contains a first name, company name, and a telephone number. Create a Contacts class that contains a dynamically allocated array of BusinessPartners as well as the owner's name and cell phone number.

  Write a function template square()

Write a function template Square() that returns the square of its only argument.

  Write a program that calculates an employees wage for a

write a program that calculates an employees wage for a week. an employees wage is calculated as followsi if the number

  Use selection sort to sort a[48] into increasing order

Use selection sort to sort A[48] into increasing order, and then print out the sorted list in four rows. There may be duplicates, but that's OK. (65 and 53 appear twice.) Duplicates will appear next to each other in the sorted list.

  Write a program that draws a picture of a house

Write a program that draws a picture of a house. It could be as easy as the accompanying figure, or if you like, make it more elaborate (3-D, skyscraper, marble columns in the entryway, whatever).

  Determine frequency of each character found in the array

Determines the frequency of each character found in the array - array of pointers to strings and the number of strings as arguments

  Write a program that will read in number of 2 point basket

Write a program that will read in the number of 2 point baskets and the number of 3 point baskets a player makes.  Print the number of each baskets and the total number of points scored.

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