Hello, I've enclosed a completed project (my first!) and would like
to know of it's accuracy. Also, what I could do to simplify the
language.
Thanks,
Pat
# Problem Set 1
# Name P Wethington
# Collaborators :None
# Time #1:00
# This is a program intended to compute the number of students who will benefit from a grant, also what
# amount the last student will receive.
principal = 500000 # Starting fund amount.
balance = principal
interestRate = .05 # Interest rate added to the principal annaully.
tuition = -34986 # Starting interest rate
tuitionInc = .041# The annual increase applied to the tuition.
count = 0 # keeps me informed on the number of students benefitting from this grant.
if count == 0: # This is to show the starting balance.
print principal, "Is the starting principal"
print -tuition, "Is the starting tuition."
print principal + tuition," the amount remaining after first tuition deduction. "
balance = principal + tuition
count = count + 1
if count ==1:
newPrincipal = (balance * interestRate) # calculates the amount added to the fund.
print newPrincipal," Interest added to fund for one year. "
print balance + newPrincipal, "is the new balance."
count = count + 1
newBalance = balance + newPrincipal
while principal > 0 + -tuition:
if count > 1:
newTuition = (tuition * tuitionInc) #calculates the rising cost of tuition.
tuition = tuition + newTuition
if newBalance < -tuition:
print newBalance + newPrincipal
newBalance = principal
print principal," is the new balance. "
newPrincipal = (principal * interestRate)
print newPrincipal," is the new interest on the principal. "
print principal + newPrincipal,"is the new principal. "
balance = principal + newPrincipal
count = count + 1
newTuition = (tuition * tuitionInc) #calculates the rising cost of tuition.
tuition = tuition + newTuition
print -tuition," is the new cost of tuition. "
principal = newBalance + tuition
print principal," is the new balance. "
newPrincipal = (principal * interestRate)
print newPrincipal," is the new interest on the principal. "
print principal + newPrincipal,"is the new principal. "
balance = principal + newPrincipal
count = count + 1
if -tuition > principal:
print principal + newPrincipal, "was available for the last student."
if count > 10:
print count, "Students used this grant."
_______________________________________________
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor