Create a program that contains one class that has all the planets and so you can add more or delete. The planets should have the surface area, and the density of each planet where g is acceleration due to gravity.
it needs to have a menu that looks like this:
1. Add
2. Delete
3. Sort
4. Find
5. Display All
6. Exit
class SolarSystem
{
public:
SolarSystem();
add(double, double); //adds a planet
remove(double, double); //removes a planet
sort(); //sort function
find(double, double); // finds a planet
display(); //display all the link list
private:
class Planet //link list of planets
{
public:
double surface_area;
double density;
Planet * next; //points to the next planet in line
};
Planet* firstplanet; //pointer to first planet
};
class SolarSystem
{
public:
SolarSystem();
add(Planet* pal); //adds a planet
remove(Planet* pal); //removes a planet
sort(); //sort function
find(Planet* pal); // finds a planet
display(); //display all the link list
private:
Planet* firstplanet; //pointer to first planet
};
class Planet //link list of planets
{
private:
double surface_area;
double density;
public:
Planet() { }
Planet( double sa , double den ) : surface_area( sa ) , density( den ) { }
setSurfaceArea( double sa ) ;
setDensity( double den);
double get SurfaceArea( ) ;
double getDensity() ;
};