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 that grades the written portion

The local driver's license office has asked you to write a program that grades the written portion of the driver's license exam. The exam has 20 multiple choice questions.

  Calculate the net pay as the gross less the taxes

Design and code a new function that accepts as parameters the gross pay by value and the federal tax, state tax, local tax, SS tax, and net Pay by reference.

  Prepare a linux shell in other words write a cc program

prepare a linux shell in other words write a cc program that will recursively prompt for input from the user. the shell

  Why is programming is needed now-a-days

Why is programming is needed now-a-days. what is the benefit of colleges to apply heavy loads on students head.

  Analyze a basic set of requirements for a problem

Analyze a basic set of requirements for a problem - Compose basic C++ language programs

  Write a program that sorts a linked list

Write a program that sorts a linked list of integers using merge sort. the program will read the integers froma file onto a linked list and then sort the linked list using MERGE SORT. this will require additional linked lists but you should use li..

  Program that would display a letter to a friend

Writing a c++ program that would display a letter to a friend? It should have a proper format like name, friends name, address.....etc

  Create a class to hold credit card information

The information to store is the card type (Visa, Mastercard, etc.) card number, the limit, and the current balance.

  Compare the running time of two versions of the insertion

implement Uniform Random Number generator and Generate 1000 Random number between 0 an 10000. Try to use insertion sort to sort them. Compare the running time of two versions of the insertion sort.

  Create a program that will input a group of floating point

Create a program that will input a group of floating point values, storing them as double values in an array. This array will then be sent to three functions.

  Find the retail price for each product

Your program should use a switch statement to find the retail price for each product - Use a sentinel-controlled loop to decide when the program should stop looping and show the final output.

  Modify the payroll program

Modify the Payroll Program so that it uses a class to store and retrieve the employee's name, the hourly rate, and the number of hours worked.

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