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

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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