Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

Students also viewed these Databases questions