Please send questions to
st10@humboldt.edu .
# Contract: main: asking_profits -> void
#
# Purpose: Interactively ask user for different ticket prices, over
# and over, each time printing to the screen the profit that
# would result for that ticket price, until user enters a
# ticket price of -1.
#
# Examples: if, when prompted, user enters ticket prices of 5, 4.9, and then
# -1, the following would be printed to the screen (with prompts
# in between...):
#
# profit for a ticket price of 5.0 is: 415.2
#
# profit for a ticket price of 4.9 is: 476.1
#
# Thank you -- good-bye!
#
# By: Sharon M. Tuttle
# last modified: 03-07-07
from profit_ex import *
def asking_profits():
# set up needed local variables
SENTINEL_TICKET_PRICE = -1;
# ask user for first ticket price
print "enter a ticket price for which you'd like to see "
curr_ticket_price = float(raw_input(
" the profit (or enter -1 to stop): "))
# compute profit for each input ticket_price until the sentinel
# is entered
while (curr_ticket_price != SENTINEL_TICKET_PRICE):
print ""
print "profit for a ticket price of " + str(curr_ticket_price),
print "is: " + str(profit(curr_ticket_price))
print ""
print "enter the next ticket price for which you'd like to see ";
curr_ticket_price = float(raw_input(
" the profit (or enter -1 to stop): "))
print ""
print "Thank you -- good-bye!"