ule main()    Call declareVariables(endProgram, endOrder, totalBurger,                          totalFry, totalSoda, total, tax, subtotal,                          option, burgerCount, fryCount, sodaCount)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Write a python code for this pseudocode

The Pseudocode

 

Module main()

   Call declareVariables(endProgram, endOrder, totalBurger,

                         totalFry, totalSoda, total, tax, subtotal,

                         option, burgerCount, fryCount, sodaCount)

 

   // Loop to run program again

   While endProgram == "no"

      Call resetVariables(totalBurger, totalFry, totalSoda, total,

                          tax, subtotal)       

      // Loop to take in order

      While endOrder == "no"

         Display "Enter 1 for Yum Yum Burger"

         Display "Enter 2 for Grease Yum Fries"

         Display "Enter 3 for Soda Yum"

         Input option

         If option == 1 Then

            Call getBurger(totalBurger, burgerCount)

         Else If option == 2 Then

            Call getFry(totalFry, fryCount)

         Else If option == 3 Then

            Call getSoda(totalSoda, sodaCount)

         End If

 

         Display "Do you want to end your order? (yes/no): "

         Input endOrder

      End While

     

      Call calcTotal(burgerTotal, fryTotal, sodaTotal, total,

                     subtotal, tax)

      Call printReceipt(total)

 

      Display "Do you want to end the program? (yes/no): "

      Input endProgram

   End While     

End Module

 

Module declareVariables(String Ref endProgram, String Ref endOrder,

                        Real Ref totalBurger, Real Ref totalFry, Real

                        Ref totalSoda, Real Ref  total, Real Ref tax,

                        Real Ref subtotal, Real Ref option,

                        Real Ref burgerCount, Real Ref fryCount, Real

                        Ref sodaCount)

 

   Declare String endProgram = "no"

   Declare String endOrder = "no"

   Declare Real totalBurger = 0

   Declare Real totalFry = 0

   Declare Real totalSoda = 0

   Declare Real total = 0

   Declare Real tax = 0

   Declare Real subtotal = 0

   Declare Integer option = 0

   Declare Integer burgerCount = 0

   Declare Integer fryCount = 0

   Declare Integer sodaCount = 0

End Module

 

Module resetVariables (Real Ref totalBurger, Real Ref totalFry,

                       Real Ref totalSoda, Real Ref total,

                       Real Ref tax, Real Ref subtotal)

   // reset variables

   totalBurger = 0

   totalFry = 0

   totalSoda = 0

   total = 0

   tax = 0

   subtotal = 0

End Module

 

Module getBurger(Real Ref totalBurger, Integer burgerCount)

   Display "Enter the number of burgers you want"

   Input burgerCount   

   Set totalBurger = totalBurger + burgerCount * .99

End Module

 

Module getFry(Real Ref totalFry, Integer fryCount)

   Display "Enter the number of fries you want"

   Input fryCount

   Set totalFry = totalFry + fryCount * .79

End Module

 

Module getSoda(Real Ref totalSoda, Integer sodaCount)

   Display "Enter the number of sodas you want"

   Input sodaCount     

   Set totalSoda = totalSoda + sodaCount * 1.09

End Module

 

Module calcTotal(Real totalBurger, Real totalFry, Real totalSoda,

                 Real Ref total, Real subtotal, Real tax)

   Set subtotal = totalBurger + totalFry + totalSoda

   Set tax = subtotal * .06

   Set total = subtotal + tax

End Module

 

Module printReceipt(Real total)

   Display "Your total is $", total

End Module

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage