In: Computer Science
put a loop around the main module that will ask the user if they want to run the program again with another week of lemonade and cookie sales.
def main():
# constants given
CUP_COST= .05
LEMONADE_MIX_OZ_COST =.10
COSTOFCOOKIES = .11
COOKIESALE = .25
#inputs
numberOfCupsUsed=int(input('Enter the number of cups used this week
'))
ouncesOfMixUsed=int(input('Enter ounces of Lemonade mix used
'))
salesForWeekLemonade=float(input('Enter total Lemonade sales for
the week $'))
cookiesSoldForWeek = int(input("Enter number of cookies sold for
the week: "))
#processing
costOfCups = numberOfCupsUsed * CUP_COST
costOfMix = ouncesOfMixUsed * LEMONADE_MIX_OZ_COST
salesTaxLemonade = computeSalesTax(salesForWeekLemonade)
profitLemonade = salesForWeekLemonade - costOfCups - costOfMix -
salesTaxLemonade
costcookies = COSTOFCOOKIES * cookiesSoldForWeek
saleofcookies = COOKIESALE * cookiesSoldForWeek
salesTaxCookies = computeSalesTax(saleofcookies)
profitcookie = saleofcookies - costcookies - salesTaxCookies
#output
print('lemonade sales for week is......
$',salesForWeekLemonade,sep="")
print('lemonade sales Tax is...........
$',salesTaxLemonade,sep="")
print('lemonade cost of cups is ....... $',costOfCups,sep="")
print('lemonade cost of mix is......... $',costOfMix,sep="")
print('lemonade profit for week is.....
$',profitLemonade,sep="")
print ("Number of cookies sold", cookiesSoldForWeek)
print("cost of cookies sold", costcookies)
print("sale amount of cookies",saleofcookies)
print("profit of selling cookies", profitcookie)
print('total profit from lemonade and cookies is',profitcookie +
profitLemonade)
if profitcookie > profitLemonade:
print("cookies sold more than lemonade")
elif profitLemonade > profitcookie:
print("lemonade sold more than cookies")
else:
print("Both lemonade and cookies are equal")
def computeSalesTax(sales):
SALES_TAX_RATE=.07
taxes = SALES_TAX_RATE * sales
return taxes
main()
def main():
# constants given
CUP_COST= .05
LEMONADE_MIX_OZ_COST =.10
COSTOFCOOKIES = .11
COOKIESALE = .25
again = "y"
while again.lower()!="n":
#inputs
numberOfCupsUsed=int(input('Enter the number of cups used this week
'))
ouncesOfMixUsed=int(input('Enter ounces of Lemonade mix used
'))
salesForWeekLemonade=float(input('Enter total Lemonade sales for
the week $'))
cookiesSoldForWeek = int(input("Enter number of cookies sold for
the week: "))
#processing
costOfCups = numberOfCupsUsed * CUP_COST
costOfMix = ouncesOfMixUsed * LEMONADE_MIX_OZ_COST
salesTaxLemonade = computeSalesTax(salesForWeekLemonade)
profitLemonade = salesForWeekLemonade - costOfCups - costOfMix -
salesTaxLemonade
costcookies = COSTOFCOOKIES * cookiesSoldForWeek
saleofcookies = COOKIESALE * cookiesSoldForWeek
salesTaxCookies = computeSalesTax(saleofcookies)
profitcookie = saleofcookies - costcookies - salesTaxCookies
#output
print('lemonade sales for week is......
$',salesForWeekLemonade,sep="")
print('lemonade sales Tax is...........
$',salesTaxLemonade,sep="")
print('lemonade cost of cups is ....... $',costOfCups,sep="")
print('lemonade cost of mix is......... $',costOfMix,sep="")
print('lemonade profit for week is.....
$',profitLemonade,sep="")
print ("Number of cookies sold", cookiesSoldForWeek)
print("cost of cookies sold", costcookies)
print("sale amount of cookies",saleofcookies)
print("profit of selling cookies", profitcookie)
print('total profit from lemonade and cookies is',profitcookie +
profitLemonade)
if profitcookie > profitLemonade:
print("cookies sold more than lemonade")
elif profitLemonade > profitcookie:
print("lemonade sold more than cookies")
else:
print("Both lemonade and cookies are equal")
again=input("Do you want to run again for another week? (y/n):
")
def computeSalesTax(sales):
SALES_TAX_RATE=.07
taxes = SALES_TAX_RATE * sales
return taxes
main()