Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using namespace std; class Point private: int x.y: public Point (int a=0.int b=0); // initialize the x and y coordinates of a Point double Distance(Point
using namespace std; class Point private: int x.y: public Point (int a=0.int b=0); // initialize the x and y coordinates of a Point double Distance(Point &C); // calculates the distance between two locations, the value is in meters void print0; // prints the x and y coordinates of a Point void setDatalinta, int b); // set the values of the x and y coordinates of a Point ): Assume all functions of the class point are defined and implemented correctly. Read the comments to understand the usage of the function. You cannot modity the above class. Create a class Rocket that has the following data attributes: coordinates, ID of type integer, speed of type integer. The coordinates represents the x and y location of the rocket, make use of class point. ID is a constant serialinteger that is given values according to the following serial numbers 100, 200, 300, etc. Do not separate class implementation The class should have the following member functions: Assume all functions of the class point are defined and implemented correctly. Read the comments to understand the usage of the function. You cannot modity the above class. Create a class Rocket that has the following data attributes: coordinates, ID of type integer, speed of type integer. The coordinates represents the x and y location of the rocket, make use of class point. ID is a constant serialinteger that is given values according to the following serial numbers 100, 200, 300, etc. Do not separate class implementation The class should have the following member functions: 1. A default constructor. 2. An initializer constructor to initialize all data members of a Rocket, do any necessary validations 3. A copy constructor. 4. Write setter and getter functions for speed data member. 5. A function bool Safe (Rocket&r) that returns true if the two Rocket objects are in safe distance from cach other. Two Rockets are considered in safe distance not to hit each other if they are 100 meters or morc far from cach other. 6. A function double Distance (Rocket&r) that returns the distance between two Rocket objects. Note: you must use the Distance function in Point class
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started