Question: 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
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:
1. All in C++ , please add comments and provide a full screenshot of full code
2. PLEASE USE THIS CIRCLE CLASS DECLARATION that is provided below...
class Circle{ public: Circle(); // Default constructor with no parameters Circle(double rad); // Constructor that accepts a radius value void setRadius(double rad); // Sets the radius double calcArea(); // Returns the area of the circle double calcDiameter(); // Returns the diameter of the circle double calcCircumference(); // Returns the circumference of the circle double getRadius(); // Returns the value of the radius
private: double radius; };
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
