Question: Problem 1. 1. Create a new C++ project, named hw3. 2. Design a class Shape that stores x and y coordinates of a shape. Write

Problem 1. 1. Create a new C++ project, named hw3.

2. Design a class Shape that stores x and y coordinates of a shape. Write the classdeclaration in the header file (.h) and the class definition in the implementation

file (.cpp). Your class must have the following public methods: constructor with two arguments for x and y draw prints statement, such as drawing a shape with coordinates (2.3) print prints statement, such as this is a shape with coordinates (2.3)

3. Create a main.cpp source file with int main() function.

4. Write test code to create three objects of type Shape. Call both draw and print

method on each object.

5. Create pointers for each of your three objects.

6. Call both draw and print function on each object using these pointers with the ->operator.Your program should produce an output similar to the following:

calling the draw() function:

drawing a shape with coordinates (10, 24)

drawing a shape with coordinates (4, 2)

drawing a shape with coordinates (-5, 8)

calling the print() function:

printing a shape with coordinates (10, 24)

printing a shape with coordinates (4, 2)

printing a shape with coordinates (-5, 8)

USING POINTERS:calling the draw() function:

drawing a shape with coordinates (10, 24)

drawing a shape with coordinates (4, 2)

drawing a shape with coordinates (-5, 8)

calling the print() function:

printing a shape with coordinates (10, 24)

printing a shape with coordinates (4, 2)

printing a shape with coordinates (-5, 8)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!