Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a class named Pi zza. Data ? elds include a string ? eld for toppings (su

ID: 3659814 • Letter: D

Question

Design a class named Pi zza. Data ? elds include a string ? eld for toppings (such as pepperoni), numeric ? elds for diameter in inches (such as 12), and price (such as 13.99). Include methods to get and set values for each of these ? elds. Create the class diagram and write the pseudocode that de? nes the class. b. Design an application that declares two Pi zza objects and sets and displays their values. c. Design an application that declares an array of 10 Pi zzas. Prompt the user for data for each of the Pi zzas, then display all the values.

Explanation / Answer

class Pizza { string topping; float diameter; float price; public void setPizzaDetail(string top, float dia, float pri) { topping = top; diameter = dia; price = pri; } public string getPizzaDetailTopping() { return topping; } public float getPizzaDetailDiameter() { return diameter; } public float getPizzaDetailPrice() { return price; } } Or you can try the other method as follows private string pizzaTopping; // Declare string: public string Topping { get { return pizzaTopping; } set { pizzaTopping = value; } } Similarly write for other details of dia and price

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote