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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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