Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Two Part Question all in C++ Part 1: Write a class declaration for a class named Circle, which has the data member radius , a

Two Part Question all in C++

Part 1: Write a class declaration for a class named Circle, which has the data member radius , a double , and member functions setRadius() which sets radius, calcArea() which returns the area of the circle, calcDiameter() which returns the diameter of the circle, calcCircumference() which returns the circumference of the circle, and getRadius() which returns the value of radius. The class should have a default constructor that has no parameters and sets radius to 1 and a second constructor which accepts a parameter of double named rad for the radius of the circle. Write the code for these as inline functions. Write a main() function that declares a Circle object and tests out ALL of the Circle class's functionality. You are responsible for demonstrating all the functionality.

Part 2: Write a class declaration for a class named Pizza that has the data members price, a double, and size, a Circle object (FROM 7.10 MINI-PROGRAMMING PROJECT A). It also has member functions: setPrice() which sets the data member price, setSize() which sets the Circle data member, and costPerSqln() which returns the double value that is the cost per square inch of the pizza. Write the code for these as inline functions. Your Pizza class will also need to have a default constructor which has no parameters and sets the price to $5.00 and the size to a radius of 6. It will also have another constructor which accepts two parameters: P for price and S for size. Write a main() program that makes two Pizza objects to test out the two constructors. The main() program also needs to test out the setPrice(), setSize(), and costPerSqIn() member functions. NOTE: YOU WILL NEED TO COPY THE CIRCLE CLASS FROM 7.10 MINI-PROGRAMMING PROJECT INTO YOUR PROJECT. Please add screenshot of code if possible thank you

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Optimizing Data Collection In Warzones

Authors: Aaget Aamber

1st Edition

B0CQRRFP5F, 979-8869065902

More Books

Students also viewed these Databases questions

Question

13.5 Multicollinearity

Answered: 1 week ago

Question

=+ 4. What information remains to be obtained?

Answered: 1 week ago