Can anyone help how to start this off? in c++ I\'m really rusty 1. Objects Base
ID: 3787628 • Letter: C
Question
Can anyone help how to start this off? in c++ I'm really rusty
1. Objects
Base Class Ship
{designation - ID
type
x, y, z location in Cartesian plane
current and max speed
fuel cap = 100 with specific fuel use information
assigned sector
{
bearing +- and range +- forming a partial cone
}
guide location and guide spd,
bool aircraft ///true for airwings and rotary wing (aka Lamps)
bool refuel/// if true -> message guide
functionality:
move() ///as a command to guide
follow() /// move for non guide ships
refueling()
One Inherited class Submarine
only ship allowed to have a positive Z location.
follow for this ship has sector hard coded = 360 and Range 0 to max
Design development
1. base class -> testing criteria
document with test cases and test results
driver to load and feed test cases and to check for expected results
WRITE the base class
Test it.
2. Same for Derived class
3. Same for user interface functions
4. Test in the integration of the objects, the user interface and the code proper
Explanation / Answer
#include<iostream>
class Ship {
private:
string designationID;
string type;
int x,y;
int currSpeed,maxSpeed,sector;
int fuelCap=100;
bool aircraft,refuel
public:
//Write Getters and setters for private variables
//Write functions move(),follow(),refueling() definations
};
#include<iostream>
class Submarine: public Ship {
private:
int z; // Defined in Submarine class because only a Submarine can have z location.
int sector=360;
int rangeFrom=0;
int rangeTo=100; //Assumed max range
public:
//Write functions move(),follow(),refueling() Implementations
};
For Designing test cases you need to take different scenerios like only Submarine can have z co-ordinate. So i am assuming there would be more of child classes. So this test case should pass for Submarine and fail for other childern. Similarly design test cases for all situations/conditions.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.