Reference no: EM132209682
Write a program that creates a class hierarchy for simple geometry. IN C++
1. Start with a Point class to hold x and y values of a point. Overload the << operator to print point values, and the + and - operators to add and subtract point coordinates (Hint: keep x and y separate in the calculation).
2. Create a pure abstract base class Shape, which will form the basis of your shapes. The Shape class will contain abstract functions to calculate area and circumference of the shape, plus provide the coordinates (Points) of a rectangle that encloses the shape (a bounding box). These will be overloaded by the derived classes. Create a display() function that will display the name of the class, and all stored information about the class (including area, circumference, and bounding box).
3. Build the hierarchy by creating the Shape classes Circle, Square, and Triangle. For these derived classes, create default constructors, and constructors whose arguments can initialize the shapes appropriately using the correct number of Point objects (i.e., Circle requires a Point center and a radius, Square requires four Point vertices, while Triangle requires three Point vertices).
4. In main(), create one instance each of the following: Circle (10, -5) with a radius of 23; Square (5, -5)(-10,7)(4,23)(-6,12); and Triangle(0,0)(10,10)(-15,15). Display the information from each object.
Write a program that declares and initializes 2 integer
: Write a program that declares and initializes 2 integer variables a and b with the values 35 and 14 and displays and calculates their sum.
|
Create and print a random phone number of the form
: Write a program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output.
|
Write a program that creates 2 posix threads
: Write a program that creates 2 posix Threads. First thread must write lowercase letters from 'a' to 'z' on the screen and the second thread.
|
Implement a priority based pre-emptive scheduling algorithm
: Write a program in either C or C++ that implements a Priority based Pre-emptive Scheduling Algorithm.
|
Create a display function that will display the name
: Create a display() function that will display the name of the class, and all stored information about the class including area, circumference, and bounding box.
|
Write a program which will display the menu
: Write a program, which will display the menu with 5 items. It will ask the use to give their choice.
|
Write a program to create a user defined java method
: Write a program to Create a user defined java method that accepts as parameters, 2 Strings.
|
Write a program to guess a magic number
: Write a program to determine, and output to the screen, the class of an earthquake, given its magnitude.
|
Write a program that displays all the numbers
: Write a program that displays all the numbers from 100 to 1,000. ten per line, that are divisible by 5 and 6. Numbers are separated by exactly one space.
|