Write a program that demonstrates the circle class

Assignment Help Programming Languages
Reference no: EM131674161

Assignment

Write a class named Circle, with the class declaration in a file called Circle.h and the implementation in a file called Circle.cpp. The class will have two data members, a double that holds the radius of the circle and a double called pi which will be set to the value, 3.14159 (data member cannot be set in the class declaration, pi should not be set via a parameter but set in the constructor). The class must provide the following member functions

• Default Constructor - that sets the radius to 0.0

• Constructor - that accepts the radius of the circle as an argument

• setRadius - a mutator function for the radius variable

• getRadius - an accessor function for the radius variable

• getArea - calculates and returns (as double) the area of the circle using the formula

area = pi * radius * radius

• getDiameter - calculates and returns (as double) the diameter of the circle using the formula

diameter = radius * 2

• getCircumference - calculates and returns (as double) the circumference of the circle using the formula

circumference = 2 * pi * radius

Write a program that demonstrates the Circle class by asking the user for the circle's radius and creating a Circle object and then reporting the circle's area, diameterand circumference. Two objects need to be created each using one of the two constructors (showing that both work along with the mutators and accessors).

Reference no: EM131674161

Questions Cloud

Write a class named employee with the class declaration : Write a class named Employee, with the class declaration in a file called Employee.h and the implementation in a file called Employee.cpp.
What is the biggest upset in the history of woman softball : what is the biggest upset in the history of woman softball?
Which significant effect researcher typically analyze first : A researcher obtains a significant interaction and a significant main effect. Which significant effect should the researcher typically analyze first? Explain.
What would be the 3 rules you would have for your team : if you were a coach, what would be the 3 rules you would have for your team?
Write a program that demonstrates the circle class : Write a program that demonstrates the Circle class by asking the user for the circle's radius and creating a Circle object and then reporting the circle's area.
Effectiveness of each of three marketing commercials : A behavioral psychologist asks the same group of participants to rate the effectiveness of each of three marketing commercials.
Measure moral reasoning among the given sampled : A social scientist asks a sample of men and women to read a vignette describing an immoral act for reasons of preservation, protection, or self-gain.
What data would you expect to fail your validation testing : What data would you expect to fail your validation testing? What use cases will you consider-what user profiles would you expect to visit your site?
Why partial etasquared-appropriate estimate of effect size : Measuring effect size for observations made over time. In a study investigating how consumption of water during a meal influenced food intake, Andrade, Kresge.

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