This is a python code                                   Fix these issues: -1  1. Checking:    handleCheckMenu:   Why check for option 4?  It'll never get into the while loop if the choice is 4! -3  2. Savings Menu     After any option in savings menu, sends back to main. Why? Should continue displaying savings menu until user selects "Back to Main" option.     Interest should be calculated using 2%.  Your program uses 20% -3  3. While in checking menu, after deposit, sends back to main. Why? After any option in checking menu, sends back to main. Why? Should continue displaying checking menu until user selects "Back to Main" option.  Checking menu:  enters infinite loop if user enters 9 for the choice: Checking Menu 1. Deposit 2. Withdrawal 3. Display Checking Balance 4. Return to Main Menu Enter a choice: 9 ================================== def createMenu(listOfChoices, MenuTitle): ct = 1 MenuTitle += '\n' for i in listOfChoices: choice = str(ct) + '. ' + i + '\n' MenuTitle += choice ct += 1 return MenuTitle def getValidChoice(Menu,upperLimit): print(Menu) ch = input("Enter a choice: ") while ch.isdigit() == False or int (ch) < 1 or int (ch) > upperLimit: print('Invalid input') #The message would be false because you entered a less print(Menu) ch = input("Enter a choice: ") return int(ch) def deposit(checkingBalance): amt = int(input("Enter the amount to deposit: ")) checkingBalance = checkingBalance+amt print("Successfully deposited $",amt," to your account.") return checkingBalance   def handleCheckMenu(upperLimit,MenuStr,CheckBalance): ch = getValidChoice(MenuStr,upperLimit) while ch != upperLimit: if ch == 1: CheckBalance= deposit (CheckBalance) return CheckBalance elif ch == 2: CheckBalance= withdrawal (CheckBalance) return CheckBalance elif ch == 3: print('Checking Balance is:$ ', CheckBalance) return CheckBalance elif ch == 4: return def handleSaveMenu(upperLimit,MenuStr,SaveBalance): ch = getValidChoice(MenuStr,upperLimit) while ch != upperLimit: if ch == 1: showSavingBalance (SaveBalance) return SaveBalance elif ch == 2: SaveBalance=showInterestEarned (int(SaveBalance)) return SaveBalance elif ch == 3: return SaveBalance #ch = getValidChoice(MenuStr,upperLimit) #return SaveBalance def showInterestEarned(savingBalance): interest = (0.2)*savingBalance savingBalance = savingBalance + (0.2)*savingBalance print("you have earned $ ",interest," as interest") return savingBalance def withdrawal(checkingBalance): #To Withdrawal money from account amt = int(input("Enter the amount to withdraw: $ ")) if (checkingBalance - amt) >=0 : checkingBalance = checkingBalance-amt print("Successfully withdraw $ ",amt," from your account.") else: print("Withdrawal isn't possible, overdraft not allowed") return checkingBalance def showSavingBalance(savingBalance): print("Savings Balance = ",savingBalance) def showcheckingBalance(checkingBalance): print("Savings Balance = ",savingBalance) def main(): mainMenu = createMenu(['Checking Account','Saving Account','Exit'],'Main Menu') checkingMenu = createMenu(['Deposit','Withdrawal','Display Checking Balance','Return to Main Menu'],'Checking Menu') savingMenu = createMenu(['Display Savings Balance','Display Interest Earned',\ 'Return to Main Menu'],'Saving Menu' ) ch = getValidChoice(mainMenu,len(mainMenu)) savingBalance = 100 CheckingBalance = 0 while ch != len(mainMenu): if ch == 1: CheckingBalance=handleCheckMenu(len(checkingMenu),checkingMenu,CheckingBalance) if ch == 2: savingBalance=handleSaveMenu(len(savingMenu),savingMenu,savingBalance) ch = getValidChoice(mainMenu,len(mainMenu)) if ch ==3: return print('Thanks for using this program')     if __name__=='__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

                                    This is a python code                                

  Fix these issues:

-1  1. Checking:
   handleCheckMenu:
  Why check for option 4?  It'll never get into the while loop if the choice is 4!

-3  2. Savings Menu
    After any option in savings menu, sends back to main. Why? Should continue displaying savings menu until user selects "Back to Main" option.
    Interest should be calculated using 2%.  Your program uses 20%

-3  3. While in checking menu, after deposit, sends back to main. Why?

After any option in checking menu, sends back to main. Why? Should continue displaying checking menu until user selects "Back to Main" option.

 Checking menu:  enters infinite loop if user enters 9 for the choice:

Checking Menu
1. Deposit
2. Withdrawal
3. Display Checking Balance
4. Return to Main Menu

Enter a choice: 9

==================================

def createMenu(listOfChoices, MenuTitle):
ct = 1
MenuTitle += '\n'
for i in listOfChoices:
choice = str(ct) + '. ' + i + '\n'
MenuTitle += choice
ct += 1
return MenuTitle

def getValidChoice(Menu,upperLimit):
print(Menu)
ch = input("Enter a choice: ")
while ch.isdigit() == False or int (ch) < 1 or int (ch) > upperLimit:
print('Invalid input')
#The message would be false because you entered a less
print(Menu)
ch = input("Enter a choice: ")
return int(ch)

def deposit(checkingBalance):
amt = int(input("Enter the amount to deposit: "))
checkingBalance = checkingBalance+amt
print("Successfully deposited $",amt," to your account.")
return checkingBalance

 

def handleCheckMenu(upperLimit,MenuStr,CheckBalance):
ch = getValidChoice(MenuStr,upperLimit)
while ch != upperLimit:
if ch == 1:
CheckBalance= deposit (CheckBalance)
return CheckBalance
elif ch == 2:
CheckBalance= withdrawal (CheckBalance)
return CheckBalance
elif ch == 3:
print('Checking Balance is:$ ', CheckBalance)
return CheckBalance
elif ch == 4:
return

def handleSaveMenu(upperLimit,MenuStr,SaveBalance):
ch = getValidChoice(MenuStr,upperLimit)
while ch != upperLimit:
if ch == 1:
showSavingBalance (SaveBalance)
return SaveBalance
elif ch == 2:
SaveBalance=showInterestEarned (int(SaveBalance))
return SaveBalance
elif ch == 3:
return SaveBalance
#ch = getValidChoice(MenuStr,upperLimit)
#return SaveBalance




def showInterestEarned(savingBalance):
interest = (0.2)*savingBalance
savingBalance = savingBalance + (0.2)*savingBalance
print("you have earned $ ",interest," as interest")
return savingBalance

def withdrawal(checkingBalance):
#To Withdrawal money from account
amt = int(input("Enter the amount to withdraw: $ "))
if (checkingBalance - amt) >=0 :
checkingBalance = checkingBalance-amt
print("Successfully withdraw $ ",amt," from your account.")
else:
print("Withdrawal isn't possible, overdraft not allowed")
return checkingBalance


def showSavingBalance(savingBalance):
print("Savings Balance = ",savingBalance)

def showcheckingBalance(checkingBalance):
print("Savings Balance = ",savingBalance)


def main():
mainMenu = createMenu(['Checking Account','Saving Account','Exit'],'Main Menu')
checkingMenu = createMenu(['Deposit','Withdrawal','Display Checking Balance','Return to Main Menu'],'Checking Menu')
savingMenu = createMenu(['Display Savings Balance','Display Interest Earned',\
'Return to Main Menu'],'Saving Menu' )
ch = getValidChoice(mainMenu,len(mainMenu))
savingBalance = 100
CheckingBalance = 0

while ch != len(mainMenu):
if ch == 1:
CheckingBalance=handleCheckMenu(len(checkingMenu),checkingMenu,CheckingBalance)

if ch == 2:
savingBalance=handleSaveMenu(len(savingMenu),savingMenu,savingBalance)
ch = getValidChoice(mainMenu,len(mainMenu))

if ch ==3:
return print('Thanks for using this program')

 

 

if __name__=='__main__':
main()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Concept of Flowchart
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