Q2a) A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk and the profit of each carton of milk vary from farm to farm. Write a program that prompts the user to enter: The total amount of milk produced in the morning. The cost of producing one liter of milk. The profit on each carton of milk. The program then outputs: The number of milk cartons needed to hold milk. Round your answer to the nearest integer. The cost of producing milk. The profit for producing milk. Q2b) Summary You found an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose that the total tax you pay on your summer job income is 14%. After paying the taxes, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies. After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each dollar you spend to buy savings bonds, your parents spend $0.50 to buy additional savings bonds for you. Instructions Write a program that prompts the user to enter: The pay rate for an hour and the number of hours you worked each week. The program then outputs the following: Your income before and after taxes from your summer job. The money you spend on clothes and other accessories. The money you spend on school supplies. The money you spend to buy savings bonds. The money your parents spend to buy additional savings bonds for you. Q2c) For each used car a salesperson sells, the commission is paid as follows: $20 plus 30% of the selling price in excess of the cost of the car. Typically, the minimum selling price of the car is the cost of the car plus $200 and the maximum selling price is the cost of the car and $2,000. Instructions Write a program that prompts the user to enter: Purchasing cost of the car The minimum to be added to the purchasing cost The maximum to be added to the purchasing cost Salesperson’s fixed commission Percentage of the commission The program should output: The minimum and maximum selling price of the car The salesperson’s commission range Since your program handles currency, make sure to use a data type that can store decimals.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Q2a)
A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing one liter of milk and the profit of each carton of milk vary from farm to farm.
Write a program that prompts the user to enter:
-
The total amount of milk produced in the morning.
-
The cost of producing one liter of milk.
-
The profit on each carton of milk.
The program then outputs:
-
The number of milk cartons needed to hold milk.
- Round your answer to the nearest integer.
-
The cost of producing milk.
-
The profit for producing milk.
Q2b)
Summary
You found an exciting summer job for five weeks. It pays, say, $15.50 per hour. Suppose that the total tax you pay on your summer job income is 14%.
After paying the taxes, you spend 10% of your net income to buy new clothes and other accessories for the next school year and 1% to buy school supplies.
After buying clothes and school supplies, you use 25% of the remaining money to buy savings bonds. For each dollar you spend to buy savings bonds, your parents spend $0.50 to buy additional savings bonds for you.
Instructions
Write a program that prompts the user to enter:
- The pay rate for an hour and the number of hours you worked each week.
The program then outputs the following:
-
Your income before and after taxes from your summer job.
-
The money you spend on clothes and other accessories.
-
The money you spend on school supplies.
-
The money you spend to buy savings bonds.
-
The money your parents spend to buy additional savings bonds for you.
Q2c)
For each used car a salesperson sells, the commission is paid as follows: $20 plus 30% of the selling price in excess of the cost of the car.
Typically, the minimum selling price of the car is the cost of the car plus $200 and the maximum selling price is the cost of the car and $2,000.
Instructions
Write a program that prompts the user to enter:
- Purchasing cost of the car
- The minimum to be added to the purchasing cost
- The maximum to be added to the purchasing cost
- Salesperson’s fixed commission
- Percentage of the commission
The program should output:
- The minimum and maximum selling price of the car
- The salesperson’s commission range
Since your program handles currency, make sure to use a data type that can store decimals.

Step by step
Solved in 6 steps with 3 images









