C++ Please
1. A milk carton can hold 3.78 litres of milk. Each morning, a
dairy farm ships cartons of milk to a
local grocery store. The cost of producing one litre of milk is
$0.2, and the profit of each
carton of milk is $0.04. Write a program that does the
following:
a) Prompts the user to enter the total amount of milk produced in
the morning.
b) Outputs the number of milk cartons needed to hold milk. (Round
your answer to the
nearest integer.)
c) Outputs the cost of producing milk.
d) Outputs the profit for producing milk.
2. Redo Programming question 1 so that the user
can also input the cost of producing one litre of
milk and the profit on each carton of milk.
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float quantity,carton;
float cost=0.2, profit=0.04;
float totalcost,totalprofit;
cout<<"\nEnter the total quantity of milk produced :";
cin>>quantity;
totalcost=cost*quantity;
carton=ceil(quantity/3.78);
cout<<"\nThe total number of cartons required :"<<carton;
totalprofit=carton*profit;
cout<<"\nThe total cost of production :$"<<totalcost;
cout<<"\nThe total profit :"<<totalprofit;
}


Changed code:
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
float quantity,carton;
float cost, profit;
float totalcost,totalprofit;
cout<<"\nEnter the total quantity of milk produced :";
cin>>quantity;
cout<<"\nEnter the cost of producing one litre of milk :$";
cin>>cost;
cout<<"\nEnter profit from one carton of milk :$";
cin>>profit;
totalcost=cost*quantity;
carton=ceil(quantity/3.78);
cout<<"\nThe total number of cartons required :"<<carton;
totalprofit=carton*profit;
cout<<"\nThe total cost of production :$"<<totalcost;
cout<<"\nThe total profit :"<<totalprofit;
}


If you have any doubt, comment down and get it cleared.
Also if you are satisfied please upvote thanks...
C++ Please 1. A milk carton can hold 3.78 litres of milk. Each morning, a dairy...
C++ programming exercise: 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....
c++ please
A farmer ships bottles of olive oil to a supermarket. Each olive oil bottle holds 2.5 liters of oil. The cost of producing one liter of olive oil is 1.2 JD, and the profit of each bottle of oil is 0.35 JD. Write a program that does the following: 1. Prompts the user to enter the total amount of oil (liters) produced. 2. Outputs the number of olive oil bottles needed to hold olive oil produced. (Round the...