A milk carton can hold 28297 litres of milk . Each morning, a dairy farm ships c
ID: 3745974 • Letter: A
Question
A milk carton can hold 28297 litres of milk . Each morning, a dairy farm ships cartons of milk to a local gocery store. The cost of producing one liter of is $0.38, and the profit of each carton of milk is $0.27. write a program on input and output file stream that does the following :promt the user to enter the amount of milk produced in the morning . Outputs the number of milk carton needed to hold mikl.( round answer to the nearest integer.). output the cost of producing milk. Output the profit for producing milk.
Explanation / Answer
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long prod=0;
cout<<"enter volume of milk produced this morning: ";
cin>>prod;
int cartons = (int)ceil(prod / 28297);
double cost = 0.38*prod;
cout<<" cost for producing milk is: "<<cost<<"$";
double profit = 0.27*cartons;
cout<<" profit earned is "<<profit;
}
I strongly believe that the amount of milk a carton can hold should be really less than 28297 liters. Anyway I have coded accordingly.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.