[Tutor] Need Help

Shappell, John J CW2 john.j.shappelljr at us.army.mil
Mon Jul 10 21:14:21 CEST 2006


Here is the assignment

1.	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.py

print "Welcome to the petty cash account"
print "Did you deposit or withdrawl money today"
print

# 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 

V/R

CW2 John Shappell
HHB 2-44 ADA BN
Work 270-798-6823
FAX 775-618-2455
john.shappell at campbell.army.mil
john.j.shappelljr at us.army.mil




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060710/654e4831/attachment.html 


More information about the Tutor mailing list