Computers and Technology
Computers and Technology, 08.07.2020 01:01, Usman458

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"

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 13:30, juliajordan427
Best laptops for college [$100-$500 range]?
Answers: 2
image
Computers and Technology, 24.06.2019 02:00, arubright177
Write an expression that will cause the following code to print "equal" if the value of sensorreading is "close enough" to targetvalue. otherwise, print "not equal". ex: if targetvalue is 0.3333 and sensorreading is (1.0/3.0), output is:
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, sudotoxic
Into what form does the barcode reader convert individual bar patterns?
Answers: 1
image
Computers and Technology, 24.06.2019 08:30, daskatingpanda
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
Answers: 1
Do you know the correct answer?
Write a complete C++ class to represent a sphere in three-dimensional space. Your class should consi...

Questions in other subjects:

Konu
English, 10.11.2020 08:20