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

  Create a method in the customer class file

Create a Method in the Customer Class file that will sort the Customers by ID number when called from the main program. To do this, you will need to use an Interface as described in the programming notes below.

  Write program to prints the question

Write a program that prints the question"do you want to continue?" and reads a user input. if the user input is"y", "yes", "ok", "sure", or "why not?".

  Describe object-oriented databases.

Describe the database planning and development process. What steps are involved, and what tools may be appropriate or helpful?

  Abebooks is an online bookseller it carries a

abebooks is an online bookseller. it carries a product-specific amount of safety stock for each of its products. the

  Generate an object-oriented design for a system

Generate an object-oriented design for a system that keeps tracks of your CD and DVD collection. Identify each of the classes, associated data, and operations for the classes.

  Write a regular expression that matches the string

Note that these regular expressions give all of the following symbols (operator characters) a special meaning:- Write a regular expression that matches the string "\.

  Calculate the area and perimeter of a rectangle

Design and write a program, using functions, that calculates the area and perimeter of a rectangle whose dimensions (length and width) are provided by a user.

  Write a shell script to read students first names

Write a shell script that reads 5 students' first names, last names and grades and then it calculates the average, maximum and minimum grade.

  Creating application to test class rectangle

Write down application to test class Rectangle.

  Design application to calculate and show price of order

Design the application to calculate and show the price of order, based on number of units ordered and the customer's status (either wholesaler or retailer).

  Design and run a program that takes a numerical score

Design and run a program that takes a numerical score and outputs a letter grade. Precise numeral scores and letter grades are listed show.

  Design-write program to enter score repetition structure

Design and write a program that asks the user to enter five test scores using a repetition structure. The program should display the letter grade for each score and the average test score at the end of the program.

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