Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

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... 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

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Contrast the Islamic family with the socialist-law family.

Answered: 1 week ago

Question

show an emotion when they really dont feel it (simulation).

Answered: 1 week ago