Question

In: Computer Science

Python programming c++ Write a program that computes the amount of money the cheerleaders raised during...

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!

Solutions

Expert Solution

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 :


Related Solutions

In the space provided below write a C program that computes the total amount of money...
In the space provided below write a C program that computes the total amount of money you have stored in your piggy bank. Your program does this by asking you for number of pennies, nickels, dimes, and quarters in the piggy bank and then displays how much money in total is in the piggy bank.
In the space provided below write a C ++ program that computes the total amount of...
In the space provided below write a C ++ program that computes the total amount of money you are depositing in your bank account. Your program does this by asking you to first enter the number and amount of each check you are depositing, and then it asks you to enter the type of cash bills being deposited and how many of each type, also the types of coins being deposited, and the number of each coin type.
Programming language: C++   suggested software: Code::Blocks Develop an algorithm and write a C++ program that computes...
Programming language: C++   suggested software: Code::Blocks Develop an algorithm and write a C++ program that computes the final score of a baseball game. Use a loop to read the number of runs scored by both teams during each of nine innings. Display the final score afterward. Submit your design, code, and execution result via file, if possible
Write a Python program that computes the income tax for an individual. The program should ask...
Write a Python program that computes the income tax for an individual. The program should ask the user to enter the total taxable income for the year. The program then uses the tax bracket (as shown below) to calculate the tax amount. This is based on a progressive income tax system which is how income tax is calculated in the U.S. As a result, this for example means that only income above $500,001 is taxed at 37%. Income of lower...
Write a Python program that computes the income tax for an individual. The program should ask...
Write a Python program that computes the income tax for an individual. The program should ask the user to enter the total taxable income for the year. The program then uses the tax bracket (as shown below) to calculate the tax amount. This is based on a progressive income tax system which is how income tax is calculated in the U.S. As a result, this for example means that only income above $500,001 is taxed at 37%. Income of lower...
Write a program in C that computes the area of a circle (Area = pi *...
Write a program in C that computes the area of a circle (Area = pi * r2) and the volume of a sphere (Volume = 4/3 * pi * r3). Both formulas use r which is the radius. Declare a float variable pi = 3.14159. Get the value of r from the keyboard and store it in a float variable. Display both the area of the circle and the volume of the sphere.
C PROGRAMMING 1. Write a C Language inline function that computes the cube of float X,...
C PROGRAMMING 1. Write a C Language inline function that computes the cube of float X, if X is greater than 1 and X is less than 100. Put the inline function in a main program that reads X from the keyboard, calls the function, and then outputs the result. 2. Show an empty statement and detail what it does? 3. A collection of predefined functions is called a Database                    C) Subroutine                       E) None of these Library                       D) Directive 4....
This is an exercise to design and write a Python program in good programming style for...
This is an exercise to design and write a Python program in good programming style for a simulation of stock price over a period of 100 days. In this exercise, you are asked to simulate the stock price starting at $100.00 for 100 days with a daily fluctuation based on the Normal Distribution with mean = 0.0 & sigma = 0.0125. The program will show the daily stock price, the 7-day minimum, the 7-day maximum, the 7-day average, and the...
Programming Assignment #2, Processes Write a C program (time_shm.c) that determines the amount of time necessary...
Programming Assignment #2, Processes Write a C program (time_shm.c) that determines the amount of time necessary to run a command from the command line. This program will be run as ./time <command [args...]> and will report the amount of elapsed time to run the specified command. This will involve using fork() and execvp() functions, as well as the gettimeofday() function to determine the elapsed time. It will also require the use of two different IPC mechanisms. The general strategy is...
Write a Python program that computes certain values such as sum, product, max, min and average...
Write a Python program that computes certain values such as sum, product, max, min and average of any 5 given numbers along with the following requirements. Define a function that takes 5 numbers, calculates and returns the sum of the numbers. Define a function that takes 5 numbers, calculates and returns the product of the numbers. Define a function that takes 5 numbers, calculates and returns the average of the numbers. Must use the function you defined earlier to find...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT