Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programming assignment 1.question a) Create an array to store 10 Point2D points (the Point2D class from A6). Set the coordinates from 0,0 to 9,9.

C++ programming assignment

1.question

a) Create an array to store 10 Point2D points (the Point2D class from A6). Set the coordinates from 0,0 to 9,9. Move all the points left 5 units and up 10 units. Print their new location. b) Make a new class Point3D which inherits from the Point2D class. The class has one more data member for the z coordinate. There are two constructors, a default one and one with 3 coordinates. Add the new member functions getZ, setZ and moveAlongZ. Override moveToOrigin and printLocation to do the right thing for all 3 coordinates. Make a few Point3D objects and exercise their functionality.

c) Add a new data member, string color to your Point2D class and a new getter and setter function for color. Create a Point2D object and set its color. Then create a Point3D object and try to set its color. Is the setColor behavior available for a Point3D class? Why or why not? d) Make a Point2D* pointer variable and point it to a newly created Point2D object. Make a Point3D* pointer variable and point it to a newly created Point3D object. Use the pointer variables to move the points and print their locations. e) Point a Point2D pointer to a Point3D object. Does this work? Why or why not? Use the Point2D pointer to print the location of the Point3D object. What does it print? Is that what you expected for the location of a 3D point?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

6. Discuss the steps involved in conducting a task analysis.

Answered: 1 week ago

Question

8. Explain competency models and the process used to develop them.

Answered: 1 week ago