# Input size output enter the price input price

• Homework Help
• 36
• 100% (2) 2 out of 2 people found this document helpful

This preview shows page 11 - 16 out of 36 pages.

input sizeoutput “Enter the price >>”input pricepizzas[x].setTopping(topping)pizzas[x].setDiameter(size)pizzas[x].setPrice(price)x = x + 1endwhilex = 0while x > MAXoutput “The information entered for pizza ”, x+1 output “Topping: ”, pizzas[x].getTopping()output “Diameter: ”, pizzas[x].getDiameter(), “ inches”output “Price: ”, pizzas[x].getPrice()x = x + 1endwhilestop
11
COM 204 Assignment 7d. Design an application that declares an array of 10 Pizza objects. Prompt the user fora 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.Pseudocode:startDeclarationsnum numberstring toppingnum sizenum pricenum x = 0num MAX = 10Pizza pizzas[MAX]while x > MAXoutput “Information for pizza ”, x+1output “Enter the topping >>”input toppingpizzas[x].setTopping(topping)output “Enter the size >>”input sizepizzas[x].setDiameter(size)pizzas[x] = calcPrice(pizzas[x])x = x + 1endwhile12
COM 204 Assignment 7x = 0while x > MAXoutput “The information entered for pizza ”, x+1 output “Toppings: ”, pizzas[x].getToppings()output “Size: ”, pizzas[x].getDiameter(), “ inches”output “Price: ”, pizzas[x].getPrice()x = x + 1endwhilestopPizza calcPrice(Pizza pie)Declarationsnum TWELVE_PRICE = 13.99num FOURTEEN_PRICE = 16.99num FIFTEEN_PRICE = 19.99if pie.getDiameter() = 12 thenpie.setPrice(TWELVE_PRICE)elseif pie.getDiameter() = 14 thenpie.setPrice(FOURTEEN_PRICE)elseif pie.getDiameter() = 15 thenpie.setPrice(FIFTEEN_PRICE)elsepie.setPrice(0)endifendifendifreturn pie
13
COM 204 Assignment 78.Complete the following tasks:a. Design a class named BaseballGame that has fields for two team names and a final score for each team. Include methods to set and get the values for each data field. Create the class diagram and write the pseudocode that defines the class.
14
COM 204 Assignment 7
• • • 