Question

In: Computer Science

C++ please A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm...

C++ please

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 is $0.38, and the profit of each carton of milk is $0.27. Write a program that prompts the user to enter: The total amount of milk produced in the morning. 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.

An input of 4900 must yield an output of:

How much milk did you produce? 4900
That is going to require 1296 cartons
Total Cost to Produce: $1862
Total Profit: $349.92

Solutions

Expert Solution

Screenshot

Program

#include <iostream>
using namespace std;
//Constants
const double CARTON = 3.78;
const double PRODUCE = 0.38;
const double PROFIT = 0.27;
int main()
{
   double milkProduced;
    //Prompt for the milk produced
   cout << "How much milk did you produce? ";
   cin >> milkProduced;
   //CAlculations and display result
   cout << "That is going to require " << round(milkProduced / CARTON) << " cartons\n";
   cout << "Total Cost to Produce : $" << milkProduced * PRODUCE << endl;
   cout << "Total Profit : $" << round(milkProduced / CARTON) * PROFIT << endl;
}


-----------------------------------------------------------------

Output

How much milk did you produce? 4900
That is going to require 1296 cartons
Total Cost to Produce : $1862
Total Profit : $349.92


Related Solutions

C++ program Dairy Farm decided to ship milk in containers in the form of cubes rather...
C++ program Dairy Farm decided to ship milk in containers in the form of cubes rather than cylinders. Write a program that prompts the user to input: The radius of the base of a cylindrical container The height of the cylindrical container The program then outputs: The side of the cube with the same volume as the cylindrical container with a precision of 2 decimal places. You may assume that the value of π = 3.141593.
1.​Winthrop Dairy Farms Ltd. is an Ontario corporation. The farm owns dairy cows that produce milk....
1.​Winthrop Dairy Farms Ltd. is an Ontario corporation. The farm owns dairy cows that produce milk. ​a) Describe the accounting treatment and measurement value of the dairy cows assuming the farm uses IFRS.​ ​b) Describe the accounting treatment and measurement value of the milk assuming the farm uses IFRS.​ c) Assume the farm uses IFRS and the fair value of a dairy cow increased from the 2017 year-end to the 2018 year-end. How would you record this increase in 2018?​...
The amount of milk processed daily by a local dairy farm is uniformly distributed between 52,000...
The amount of milk processed daily by a local dairy farm is uniformly distributed between 52,000 and 61,000 gallons. What is the probability that the dairy farm will process less than 53,600 gallons of milk today? ANSWER:  (Report your answer to 4 decimal places, using conventional rounding rules) What is the probability that the dairy farm will process between 57,500 and 58,400 gallons of milk today? ANSWER: (Report your answer to 4 decimal places, using conventional rounding rules) What is the...
A dairy farm faces a perfectly competitive market. It sells milk at $6 per liter. Complete...
A dairy farm faces a perfectly competitive market. It sells milk at $6 per liter. Complete the table below to answer the following questions. Quantity of output (liter) Total revenue Marginal revenue Total cost Marginal cost ATC VC AVC 0 3 1 5 2 8 3 12 4 17 5 23 6 30 7 38 8 47 a) Find the quantity of output that maximizes the profit for the firm. Also calculate the profit at that level. b) Find out...
A dairy farm faces a perfectly competitive market. It sells milk at $6 per liter. Complete...
A dairy farm faces a perfectly competitive market. It sells milk at $6 per liter. Complete the table below to answer the following questions. Quantity of output (liter) Total revenue Marginal revenue Total cost Marginal cost ATC VC AVC 0 3 1 5 2 8 3 12 4 17 5 23 6 30 7 38 8 47 a) Find the quantity of output that maximizes the profit for the firm. Also calculate the profit at that level. b) Find out...
A Tank can hold 200 liters, it currently holds 150 liters of fresh water. 2 different...
A Tank can hold 200 liters, it currently holds 150 liters of fresh water. 2 different pipes pour in mixture, one at a rate of 1kg of salt per minute at a rate of 6 liters per minute. another at a rate of 2 kg of salt at a rate of 4 liters per minute. A. If the mixture is flowed out at a rate of 10 liters per minute what is the amount of salt at time t. what...
The Shady Farm Milk Company can process milk at a fixed rate of 5100 gallons/hour. The...
The Shady Farm Milk Company can process milk at a fixed rate of 5100 gallons/hour. The company’s clients request 94000 gallons of milk over the course of one day. This demand is spread out uniformly from 8 a.m. - 6 p.m. The company starts producing at 8 a.m. and continues to work until all of the demand has been satisfied. (Round your answer to 2 decimal places.) How long does the client requesting milk at 6 p.m. have to wait...
A Bookstore Application C++ Design the class Book. Each object of the class Book can hold...
A Bookstore Application C++ Design the class Book. Each object of the class Book can hold the following information about a book: title, authors, publisher, ISBN Include the member functions to perform the various operations on the objects of Book. For example, the typical operations that can be performed on the title are to show the title, set the title. Add similar operations for the publisher, ISBN , and authors. Add the appropriate constructors and a destructor (if one is...
Explain how a full array in C can be expanded to hold more values. In your...
Explain how a full array in C can be expanded to hold more values. In your answer make sure you mention the function calls required, and anything else that is necessary to perform this task. Give a small example where an array of 100 integers is resized to be able to now store 200 integers.
Develop a C++ "doubly" linked list class of your own that can hold a series of...
Develop a C++ "doubly" linked list class of your own that can hold a series of signed shorts Develop the following functionality: Develop a linked list node struct/class You can use it as a subclass like in the book (Class contained inside a class) You can use it as its own separate class Your choice Maintain a private pointer to a node class pointer (head) Constructor Initialize head pointer to null Destructor Make sure to properly delete every node in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT