Need assistance in determining what went wrong with my code and why I cannot seem to fix all of the issues. I am using visual studio code. I need to have my python code corrected as soon as possible and learn where my errors are.  #The main function def main():     endProgram = "no"     endOrder = "no"     totalBurger = 0.0     totalFry = 0.0     totalSoda = 0.0     total = 0.0     tax = 0.0     subtotal = 0.0     option = 0     burgerCount = 0     fryCount = 0     sodaCount = 0 # Reset Variables while ("endProgram" == "no"): # reset variables totalburger, totalFry, totalSoda, total, tax, subtotal     totalBurger = 0.0     totalFry = 0.0     totalSOda = 0.0     total = 0.0     tax = 0.0     subtotal = 0.0     endOrder = "no" # Loop that takes meal order while ("endOrder" == "no"):     print ("Enter 1 for Yum Yum Burger")     print ("Enter 2 for Grease Yum Fries")     print ("Enter 3 for Soda Yum")     option = int(input("Enter options: "))     if (option == 1):         totalBurger =  "getBurger"(totalBurger, burgerCount)     elif (option == 2):         totalFry = getFry(totalFry, fryCount)     elif (option == 3):         totalSoda = getSoda(totalSoda, sodaCount)     endOrder = input("Do you want to end your order? (Enter no to process a new order)") total = "calcTotal" ("totalBurger, totalFry, totalSoda, total, subtotal, tax") printReceipt(total) endProgram = input ("do you want to end the progress?(enter no to process a new order)") def getBurger (totalBurger, burgerCount):     burgerCount = int(input("how many burgers do you want? 0 if none"))     totalBurger = totalBurger + (burgerCount * 0.99)     returntotalBurger def getFry(totalFry, fryCount):     fryCount = int(input("How many fries do you want? (0 if none) "))     totalFry = totalFry + (fryCount * 0.79)     returntotalFry def getSoda(totalSoda, sodaCount):     sodaCount = int(input("How many sodas do you want? (0 if none) "))     totalSoda = totalSoda + (sodaCount * 1.09)     returntotalSOda def calcTotal(totalBurger, totalFry, totalSoda, total, subtotal, tax):     tax = subtotal * 0.06     total = subtotal + tax     return total def printReciept (total):     print ("your total is $ {0:.2f}".format(total)) # calls main main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Need assistance in determining what went wrong with my code and why I cannot seem to fix all of the issues. I am using visual studio code. I need to have my python code corrected as soon as possible and learn where my errors are. 

#The main function
def main():
    endProgram = "no"
    endOrder = "no"
    totalBurger = 0.0
    totalFry = 0.0
    totalSoda = 0.0
    total = 0.0
    tax = 0.0
    subtotal = 0.0
    option = 0
    burgerCount = 0
    fryCount = 0
    sodaCount = 0
# Reset Variables
while ("endProgram" == "no"):
# reset variables totalburger, totalFry, totalSoda, total, tax, subtotal
    totalBurger = 0.0
    totalFry = 0.0
    totalSOda = 0.0
    total = 0.0
    tax = 0.0
    subtotal = 0.0
    endOrder = "no"
# Loop that takes meal order
while ("endOrder" == "no"):
    print ("Enter 1 for Yum Yum Burger")
    print ("Enter 2 for Grease Yum Fries")
    print ("Enter 3 for Soda Yum")
    option = int(input("Enter options: "))
    if (option == 1):
        totalBurger =  "getBurger"(totalBurger, burgerCount)
    elif (option == 2):
        totalFry = getFry(totalFry, fryCount)
    elif (option == 3):
        totalSoda = getSoda(totalSoda, sodaCount)
    endOrder = input("Do you want to end your order? (Enter no to process a new order)")
total = "calcTotal" ("totalBurger, totalFry, totalSoda, total, subtotal, tax")
printReceipt(total)

endProgram = input ("do you want to end the progress?(enter no to process a new order)")
def getBurger (totalBurger, burgerCount):
    burgerCount = int(input("how many burgers do you want? 0 if none"))
    totalBurger = totalBurger + (burgerCount * 0.99)
    returntotalBurger
def getFry(totalFry, fryCount):
    fryCount = int(input("How many fries do you want? (0 if none) "))
    totalFry = totalFry + (fryCount * 0.79)
    returntotalFry
def getSoda(totalSoda, sodaCount):
    sodaCount = int(input("How many sodas do you want? (0 if none) "))
    totalSoda = totalSoda + (sodaCount * 1.09)
    returntotalSOda
def calcTotal(totalBurger, totalFry, totalSoda, total, subtotal, tax):
    tax = subtotal * 0.06
    total = subtotal + tax
    return total
def printReciept (total):
    print ("your total is $ {0:.2f}".format(total))
# calls main
main()
Expert Solution
Introduction

While writing codes in python, we must always take care of indentation.
Indentation is very important in python.
I have highlighted all the changes done in the code.

I have also attached images of the code. 

 

Errors made in the code:

  1. improper indentation
  2. the code does not calculate sub total and hence, the end result is wrong
  3. while writing the condition in while loop, do NOT write the variable name within double quotes. Write only the string within ("") double quotes.
    For example: while ("endOrder" == "no"): is WRONG
    CORRECT: while (endOrder == "no"):
  4. while calling the printReciept (total) function, the spelling was wrong.

Rest everything is correct. 
Make sure you properly indent your code as per your requirement.

 

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Introduction to Coding
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education