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

Questions 15 and 16 refer to the following design problem. You are to create a s

ID: 3840011 • Letter: Q

Question


Questions 15 and 16 refer to the following design problem. You are to create a software design that simulates a fast food restaurant. You will have food items (hamburgers, hot dogs, chicken sandwiches) and drink items (Coke, sprite, root beer). The drinks come in various sizes given in ounces (for example: 12, 24, 48). Food items will be assigned a price when they are created but this price can be changed by the employee taking the items will be assigned according to the size of the drink. Which of the following would be the best choice for the design of this system? Why? a. The design should include the following classes: Hamburger, HotDog, Chicken, Coke, Sprite, and RootBeer. b. The design should include the following classes: FoodItem with Hamburger, HotDog, and Chicken extending FoodItem and DtrinkItem with Coke, Sprite, and RootBeer extending DrinkItem. c. The design should include the following classes: Item with FoodItem and DrinkItem extending Item: Hamburger, HotDog, and Checken extending FoodItem; and DrinkItem with Coke, sprite, and RootBeer extending DrinkItem. d. The design should include the following classes: FoodItem and DrinkItem. The individual types of food and drink are only descriptions of the food or drink and should not be separate classes. e. The design should include the following classes: Item with FoodItem and DrinkItem extending Item. The individual types of food and drink are objects that are instances of these classes, not separate classes.

Explanation / Answer

b.            The design should include the following classes: FoodItem with Hamburger, HotDog and Chicken extending FoodItem and DrinkItem with Coke, Sprite and RootBeer extending DrinkItem