Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Deliverable 3 : In this third deliverable, you are going to be using the Standard Template Library Data Structures. vector, stack, queue, forward list. Steps
Deliverable :
In this third deliverable, you are going to be using the Standard Template Library Data
Structures. vector, stack, queue, forward list.
Steps :
Select data structures out of these and implement them using the class in your
project. Build your data structure, using at least objects from your class.
Print the content of each data structure to note how objects are stored and
retrieved based on the data structure
To be returned:
Your programs.
Screen shots of your programs execution.
my class was planet, here is my code:
Planetcpp
#include "Planet.h
#include
Planet::Planet
name ;
distanceFromSun;
hasLife false;
classificationU;
diameter;
Parameterized constructor
Planet::Planetstring name, int distanceFromSun, bool hasLife, char classification, double diameter
thisname name;
thisdistanceFromSun distanceFromSun;
thishasLifehasLife;
thisclassificationclassification;
thisdiameterdiameter;
Setters functions which initialize the instance variables
void Planet::setNamestd::string name thisname name;
void Planet::setDistanceFromSunint distance distanceFromSun distance;
void Planet::setHasLifebool life hasLife life;
void Planet::setClassificationchar classification thisclassification classification;
void Planet::setDiameterdouble diameter thisdiameter diameter;
Getters functions
string Planet::getName const return name;
int Planet::getDistanceFromSun const return distanceFromSun;
bool Planet::hasLife const return hasLife;
char Planet::getClassification const return classification;
double Planet::getDiameter const return diameter;
prints Planet object
void Planet::printObject const
cout "Name: name endl;
cout "Distance from Sun: distanceFromSun million miles" endl;
cout "Has life: hasLife "Yes" : No endl;
cout "Classification: classification endl;
cout "Diameter: diameter miles" endl;
Function which Compare two Planet class objects
int Planet::compareconst Planet& other const
if distanceFromSun other.distanceFromSun
return ;
else if distanceFromSun other.distanceFromSun
return ;
else
return ;
please screen shot program of it working its giving an error on my end
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