Question: Python example needed to work off of. Write the code for the game or business solution that uses file input/output features including classes, function, list,

Python example needed to work off of.

Write the code for the game or business solution that uses file input/output features including classes, function, list, and str methods; YOU MUST VALIDATE ALL USER INPUT AND ALWAYS GIVE FRIENDLY ERROR MESSAGES. It is also important to have a control loop (outer loop) so that the player can quit the game/process when he/she wants, and explain its functionality; the game has to be functional without any error.

I would like to add a control loop that keeps asking the user if they would like to deposit or withdraw money. I would also like to add code that saves each entry to a file and to also print the contents of the file afterwards.

class Bank_Account:

def __init__(self):

self.balance=0

print("Hello!!! Welcome to the Deposit & Withdrawal Machine")

def deposit(self):

amount=float(input("Enter amount to be Deposited: "))

self.balance += amount

print(" Amount Deposited:",amount)

def withdraw(self):

amount = float(input("Enter amount to be Withdrawn: "))

if self.balance>=amount:

self.balance-=amount

print(" You Withdrew:", amount)

else:

print(" Insufficient balance ")

def display(self):

print(" Net Available Balance=",self.balance)

# Driver code

# creating an object of class

s = Bank_Account()

# Calling functions with that class object

s.deposit()

s.withdraw()

s.display()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!