Question: Write class declaration for a class named Pizza that has the data members price, a double, and size, a Circle object. It also has

Write class declaration for a class named Pizza that has the data

Write class declaration for a class named Pizza that has the data members price, a double, and size, a Circle object. 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 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 set Price(), setSize(), and costPerSqln() member functions. Write class declaration for a class named Pizza that has the data members price, a double, and size, a Circle object. 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 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 costPerSqln() member functions.

Step by Step Solution

3.49 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the class declaration for the Pizza class as described include include Define a Circle class to represent the size of the pizza class Circle pri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!