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

0,5.2 Assume that a Chocoburries wants to see a list of aW the chocolates sold i

ID: 3905456 • Letter: 0

Question

0,5.2 Assume that a Chocoburries wants to see a list of aW the chocolates sold in the (9) last month as well as the total value for all the chocolates sold. A program must accept sales data that includes the name of the chocolate item sold and its total price sold for that month To create a sales report, you must first get the chocolate type and total amount of chocolate sold from an input source until user enters zzz, then output the chocolate type and total price for each chocolate sold and add its value to an accumulator. Output the total accumulated price of all chocolates sold once user has finished entering all the chocolate items and their respective prices. The programs report should be similar to the following: MONTH-END BALE3 REPORT Brice R1O50 R2540 R5460 R2980 R3350 R15380 Rum and Raison Top Deck Mint Choco Nhole Nut Total: Use a loop and pseudocode below to complete the logic contained in the above Declarations string chocType num price num accunPrice0 num QUIT = "ZZZ', output "HONTH-END SALES REPORT output "Chocolate t output "Enter the chocolate type>> input chocType output "Total R", accumPrice Price" top

Explanation / Answer

Solution:

Please find below the pseudocode :

Start

                Declarations

                String    chocType

                num       price

                num       accumPrice = 0

                num       QUIT = “ZZZ”

                Map       chocolateMap[String:num]

                num       flag = 0

                num       sizeOfMap = 0

                num       counter

                begin-loop

do

output “Enter the chocolate type >>[type ZZZ to quit]”

input     chocType

if chocType == “ZZZ”

                                flag = 1

                                break

else

                                output “Enter the price >>”

input price

accumPrice = accumPrice + price

chocolateMap[chocType:price]

end-if

while flag != 1

end-loop

output “MONTH-END SALES REPORT”

output “Chocolate type                                               Price”

sizeOfMap = size(chocolateMap)

begin-loop

while(counter < sizeOfMap)

                output chocolateMap[chocoType]                          chololateMap[price]

                counter = counter + 1

end-loop

output “Total R”,             accumPrice

Stop