In: Computer Science
Python programming c++
Write a program that computes the amount of money the cheerleaders raised during their candy bar fundraiser using the following data:
12 bars per case.
The candy was sold for $1.00 per bar.
Each case cost $8.00.
They are required to give the student government association 10% of their earnings.
The program should ask the user how many bars were sold. The program should calculate and display the SGA proceed's, the Cheer team's proceeds, and the appropriate message depending upon if the goal was met.
The team has a goal of raising $500. If the net proceeds (amount after SGA donation) exceeds $500, display the message...Congratulations! You have raised $500 or more! If the team did not raise $500, display the message....Sorry! You did not meet your goal!
The program should NOT accept a negative number of bars. If a negative number is entered, the program should NOT move forward to calculate totals until valid data is entered.
Name the project LastnameFI_Midterm (ex. ArmwoodT_Midterm). Submit the .py file ONLY.
TIPS:
All information given will be used!
The cost of the candy IS NOT apart of the Cheerleading team's proceeds! Therefore, you must deduct what you paid for the candy (Cost of Goods Sold) before calculating what you give to SGA and what will be left as the cheer team's proceeds!
Be sure to display the SGA and Cheer team's proceeds as well as the message!
Python Program :
(use python 3 version or more)
bars_per_case = 12
cand_per_bar = 1.00
case_cost = 8.00
bars = int(input("How many bars were sold ? : ")) # ask user about bars sold
while bars < 0:
bars = int(input("Enter a valid number of bars : ")) # loop until bars entered are positive
total = 12*bars + (bars/case_cost) # calculate total earnings
sga = 0.1*total # earnings of sga
net = total - sga # net earnings
cheer_teams = (bars/case_cost) # cheer teams proceeds or earnings
print()
print("The SGA proceed's are $",sga,)
print("The cheer teams proceeds are $",cheer_teams)
print()
if net >= 500:
print("Congratulations! You have raised $500 or more!")
else:
print("Sorry! You did not meet your goal!")
Screenshot :