Complete the following tasks: a. Design a class named Pizza. Data fields include a string field for

Question:

Complete the following tasks:
a. Design a class named Pizza. Data fields include a string field for a topping (such as pepperoni) and numeric fields for diameter in inches (such as 12) and price (such as 13.99). Include methods to get and set values for each of these fields. Create the class diagram and write the pseudocode that defines the class.
b. Design an application that declares two Pizza objects and sets and displays their values.
c. Design an application that declares an array of 10 Pizza objects. Prompt the user for data for each Pizza, then display all the values.
d. Design an application that declares an array of 10 Pizza objects. Prompt the user for a topping and diameter for each Pizza, and pass each object to a method that computes the price and returns the complete Pizza object to the main program. Then display all the Pizza values. A 12−inch pizza is $13.99, a 14−inch pizza is $16.99, and a 15−inch pizza is $19.99. Any other entered size is invalid and should cause the price to be set to 0.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: