subject

Write a complete C++ class to represent a sphere in three-dimensional space. Your class should consist of a header (sphere. h) and an implementation (sphere. cpp) file as described below. The sphere class should have the following (private) attributes and (public) methods: Attributes:

x coordinate (an int), can be negative
y coordinate (an int), can be negative
z coordinate (an int), can be negative
radius (a double), must be greater than 0.0
Methods

A default constructor that creates a sphere of radius 10 at position 0,0,0
A constructor with parameters for x, y, z, and radius
void move - moves the sphere the given distances (therefore changing its x , y, and z attributes)
void setRadius(double r) - changes the sphere's radius to r, or to 10.0 if r is invalid
int getX() - returns the sphere 's x coordinate
int getY() - returns the sphere 's y coordinate
int getZ() - returns the sphere 's y coordinate
double getRadius() - returns the sphere's radius
double getVolume() - returns the sphere's area
void displaySphere() - displays the sphere's attributes like this: "radius 10.0 at point x = 12, y = 17, z=11"

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 19:30
What are loans to a company or government for a set amount of time
Answers: 1
question
Computers and Technology, 24.06.2019 12:50
What percentage of teens plays video games? a.97% b.100% c.74% d.50%
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Which computer network component connects two different networks together and allows them to communicate? a is a node (or a device) that connects two different networks together and allows them to communicate.
Answers: 1
question
Computers and Technology, 25.06.2019 00:40
Roger ginde is developing a program in supply chain management certification for managers. ginde has listed a number of activities that must be completed before a training program of this nature could be conducted. the activities, immediate predecessors, and times appear in the accompanying table: activity immediate predecessor(s) time (days) a -− 44b -− 55 c -− 11 d b 1010 e a, d 55 f c 55 g e, f 1010 calculate the slack time. show the details.
Answers: 2
You know the right answer?
Write a complete C++ class to represent a sphere in three-dimensional space. Your class should consi...
Questions
question
Mathematics, 07.05.2020 03:02
question
History, 07.05.2020 03:02
question
Mathematics, 07.05.2020 03:02
question
Medicine, 07.05.2020 03:02
question
English, 07.05.2020 03:02
question
Arts, 07.05.2020 03:02
Questions on the website: 13722363