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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:00, Janznznz1121
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, Molly666
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
image
Computers and Technology, 23.06.2019 20:30, summerhumphries3
What are some settings you can control when formatting columns?
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, janeliles
Why would a business likely use a java applet - to back up their data files for the business - to create a program that a customer can launch in their web browser - to create music on a powerpoint presentation - to organize files on their company directory
Answers: 3
You know the right answer?
Write a complete C++ class to represent a sphere in three-dimensional space. Your class should consi...

Questions in other subjects:

Konu
English, 20.09.2020 18:01
Konu
English, 20.09.2020 18:01