Question
(C++) Create a class Planet, with separate interface file (Planet.h) and implementation file (Planet.cpp), comprised of the following attributes: Data members (private): string: planetName -
(C++) Create a class Planet, with separate interface file (Planet.h) and implementation file (Planet.cpp), comprised of the following attributes:
Data members (private):
string: planetName - Name of the planet
double: planetRadius - Radius of the planet
Member functions (public):
Default constructor - Sets planetName to empty string, and planetRadius to 0.0
Parameterized constructor - Takes a string and double initializing planetName and planetRadius, in this order
getName() - Returns planetName as a string
setName(string) - (void) Assigns planetName the value of the input string
getRadius() - Returns planetRadius as a double
setRadius(double) - (void) Assigns planetRadius the value of the input double
getVolume() - Calculates and returns the volume of the planet as a double
Please create 3 files: Planet.h, Planet.cpp, and driverPlanet.cpp (a file just for testing the member functions)
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