Here is the assignment
- You've been given an assignment by your supervisor to program a small application to monitor the current status of the cash account in the firm's petty cash fund (the amount of cash kept on hand in the office for incidental purchases). The requirements for the program are to allow users to input the amount of cash deposited, the amount of cash withdrawn and to get a report of the balance at any given time. You will need to also add the date of each deposit and the date of each withdrawal and provide a date with the balance returned upon a given query. The program should be able to provide a printed report and support a command line query.
You are to use the object oriented properties of Python to accomplish this task.
This is where I am at so far. I don't understand how to get the Account class into the program. Can you help a little, Just looking for an idea or some guidance
#!/usr/bin/python
# Filename: petty cash.pyprint "Welcome to the petty cash account"
print "Did you deposit or withdrawl money today"# print out menu
print "please select a number"
print "1 for deposit"
print "2 for withdrawl"# Get user's choice:
number = input (">")
#
if number == 1:
deposit = input ("how much?")
print "I deposited:", deposit
elif number == 2:
withdrawl = input ("How Much?")
print "I withdrew:", withdrawl
print "what is today's date?"
# Get date from user
date = input (">")This is where I get stuck. The program will allow me to input the deposit or withdrawl ammount and the date but does nothing ownce it gets here
class Account:
def __init__(self, initial):
self.balance = initial
def deposit(self, amt):
self.balance = self.balance + amt
def withdraw(self,amt):
self.balance = self.balance - amt
def getbalance(self):
return self.balance
Another aspect of your assignment will be to be able to use this functionality from the "command-line". This means: without asking questions from the user, but input is being passed as arguments. You will eventually have to think how this will affect the structure of your program.
-Arcege
--
There's so many different worlds,
So many different suns.
And we have just one world,
But we live in different ones.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor