Write a program that instantiates four sphere objects

Assignment Help Programming Languages
Reference no: EM13936559

Write a program that instantiates four sphere objects (assigning a radius to each instance) and adds them to a pointer-based linked list. Include a function to display the statistics of each sphere in the list.

// ***************************************************
// Header file for the class sphereClass.
// ***************************************************
const double PI = 3.14159;
class sphereClass
{
public:
sphereClass();
// Default constructor: Creates a sphere and
// initializes its radius to a default value.
// Precondition: None.
// Postcondition: A sphere of radius 1 exists.

sphereClass(double InitialRadius);
// Constructor: Creates a sphere and initializes
// its radius.
// Precondition: InitialRadius is the desired
// radius.
// Postcondition: A sphere of radius InitialRadius
// exists.

void SetRadius(double NewRadius);
// Sets (alters) the radius of an existing sphere.
// Precondition: NewRadius is the desired radius.
// Postcondition: The sphere's radius is NewRadius.

double Radius() const;
// Determines a sphere's radius.
// Precondition: None.
// Postcondition: Returns the radius.

double Diameter() const;
// Determines a sphere's diameter.
// Precondition: None.
// Postcondition: Returns the diameter.

double Circumference() const;
// Determines a sphere's circumference.
// Precondition: PI is a named constant.
// Postcondition: Returns the circumference.

double Area() const;
// Determines a sphere's surface area.
// Precondition: PI is a named constant.
// Postcondition: Returns the surface area.

double Volume() const;
// Determines a sphere's volume.
// Precondition: PI is a named constant.
// Postcondition: Returns the volume.

void DisplayStatistics() const;
// Displays statistics of a sphere.
// Precondition: None.
// Postcondition: Displays the radius, diameter,
// circumference, area, and volume.

private:
double TheRadius; // the sphere's radius
}; // end class
// End of header file.

Reference no: EM13936559

Questions Cloud

Review the brief intervention flow chart : Review the brief intervention flow chart. What would be easy for you to adapt and what would be more challenging for you to adapt as a SUD counselor
Write table_avg function to find the average of an array. : Write table_print function to print out a table of size. Print output on one line.table_print(array, size);
Feasibility analysis for this proposed project : A business analyst working for a small business that is considering a project to implement a Customer Relationship Management (CRM) system for use by field sales personnel. The system will use the ACT! software application from Sage Software, Inc. Ma..
Who were scientist whose work fundamental to darwin theory : Vestigial Organs and Embryology are types of evidence that support the theory of natural selection. How each support the theory of natural selection?
Write a program that instantiates four sphere objects : Write a program that instantiates four sphere objects (assigning a radius to each instance) and adds them to a pointer-based linked list. Include a function to display the statistics of each sphere in the list.
Isolation successfully defended the patent : Isolation successfully defended the patent in a lawsuit at a cost of $78,100. If required, round your answer to the nearest dollar.
How much should crosby increase selling price to wholesaler : If alternative 3 is chosen based on net CM and the actual sales do not meet expectations by 20% how much should Crosby increase the selling price to the wholesaler to make $32,000 in CM?
Design a modularized body mass index (bmi) program : Design a modularized Body Mass Index (BMI) Program which will calculate the BMI of a team player.
Describe methods and the results of dobzhansky experiments : Dobzhansky's laboratory experiments studying mating behavior evolution in the fruit fly Drosophila subobscura provided a striking example of how natural selection operates. Describe the methods and the results of Dobzhansky's experiments.

Reviews

Write a Review

Programming Languages Questions & Answers

  Recursive method to read in string of characters

Trying to write a recursive method that reads in a string of characters and checks to see if the first character is either a 'D' or and 'E', then is followed by a string of one or more 'F's.

  Modeling a game using turing machine

Modeling a Game Using Turing Machine, Select a game that can be modeled by a simple Turing machine. It should take a series of inputs (such as a set of moves by a player) and use the tape and table to compute the outcome of whether the player won o..

  Write down an application with three labeled text elds one

write an application with three labeled text ?elds one each for the initial amount of a savings account the annual

  On a 3 x 4 chessboard there are 3 black knights (b b b)

On a 3 x 4 chessboard there are 3 black knights (B B B) and 3 white knights (W W W). Exchange knights in the minimum number of turns (hint: use graph representation).

  Create a file values.txt contains the data

Make sure your program is clear with no syntactical errors, correctly uses i/o syntax, correctly uses branching and looping syntax, that it contains functions with correct parameters and return values, that it correctly uses arrays, and that you p..

  Calculate the difference between the number and the average

Write a program that will input an array of 10 REAL4 numbers into an array, and that will calculate the average value of the array and the standard deviation.

  Deleting and recovering the shell path variable

Deleting and Recovering the Shell PATH Variable, uppose a CIS255 student was experimenting with shell variables and accidentally deleted his / her PATH variable. The student decided he / she does not need the PATH variable.

  Write a paper discussing threads vs processes

Write a paper discussing Threads vs Processes. What is a Thread? What is a Process? How are they different? How are they the same? What types of problems lend themselves to Threads?

  You are consulting for an organization that has unix linux

question 1 the small company where you work needs to implement a second server for its accounting systems but does not

  Compute and display total number of votes received

Display the table with appropriate labels for the rows and columns. Compute and display the total number of votes received by each candidate and the percentage of the total votes cast.

  Provide pseudocode of your overall design

our final project will be to analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as function and subprogram calls and uses arrays. ..

  Program to find if number input by user is palindrome or not

Write down the program which uses the method called palindrome ( ) to find out if number input by user is a palindrome or not. For instance 1221 is palindrome as it can be read same way forwards and backwards.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd