quiz حل الأسئلة الجامعية manage_search الأرشيف

تم الحل ✓
categoryبرمجة وتطوير البرمجيات schoolبكالوريوس event_available2026-07-13

السؤال

Transcribed Image Text:

Your local pizza shop has hired you to write a program that it can use to take pizza orders. Every pizza comes with sauce and cheese, and customers can add up to 12 extra toppings (pepperoni, sausage, ham, bacon, mushrooms, onion, green peppers, hot peppers, green olives, black olives, pineapple, or anchovies). The shop sells the following kinds of pizzas: four-slice personal pizzas for $4, extra toppings at $0.25 each eight-slice medium pizzas for $8, extra toppings at $0.50 each 10-slice large pizzas for $10, extra toppings at $0.75 each 12-slice extra-large pizzas for $12, extra toppings at $1.00 each Build a Pizza class hierarchy, with each kind of pizza as a subclass. Store each pizza's toppings in a linked list and define a getToppings () method to access it. Define an addTopping () method to add a topping to a pizza. Declare an abstract method Pizza #getTopping Price(), which each subclass defines appropriately. Define a getPrice() method that returns the total cost of a pizza, including its toppings. The toString() method should return a full description of a pizza, including its size, its number of slices, its toppings, and its total cost. When the Pizza hierarchy is built and tested, write a menu-driven program that the shop's customers can use to order one or more pizzas. For each pizza, the program should let the customer select its size and choose its toppings. The program should display a run- ning total after each choice and should display a summary of the order when the customer is finished.

check_circle الجواب — حل مفصل خطوة بخطوة

hourglass_top