Question

In: Computer Science

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:

  1. The radius of the base of a cylindrical container
  2. The height of the cylindrical container

The program then outputs:

  1. 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.

Solutions

Expert Solution

#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int main()
{
   std::cout << std::fixed;
std::cout << std::setprecision(2);
   float radius,height;
   float volume;
   //The radius of the base of a cylindrical container
cout<<"Enter the radius of the base of a cylindrical container\t:";
   cin>>radius;
   //The height of the cylindrical container
   cout<<"Enter the height of the cylindrical container\t:";
   cin>>height;
   volume=(3.141593*radius*radius*height);
   //The side of the cube with the same volume as the cylindrical container with a precision of 2 decimal places.
cout<<"The side of the cube with the same volume as the cylindrical container\t:"<< cbrt(volume) << endl;
return 0;
}


Related Solutions

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...
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...
Create a program that stores the information of up to 50 containers loaded on ship. The...
Create a program that stores the information of up to 50 containers loaded on ship. The program should contain a menu to do the following: A or a     to add a container. R or r      to retrieve the information of one container. T or t      to retrieve the information of all containers. W or w   to retrieve the total weight of the loaded containers. X or x      to exit the program Ask the user for the number of containers to...
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...
With milk sales sagging of late, The Milk Processor Education Program (MPEP) decided to move on...
With milk sales sagging of late, The Milk Processor Education Program (MPEP) decided to move on from the famous "Got Milk" ad slogan in favor of a new one, "Milk Life." The new tagline emphasizes milk's nutritional benefits, including its protein content. MPEP began collecting data on the number of gallons of milk households consumed weekly (in millions), weekly price per gallon, and weekly expenditures on milk advertising (in hundreds of dollars) for the period following the launch of the...
Programming Language C++ Task 1: Write a program to calculate the volume of various containers. A...
Programming Language C++ Task 1: Write a program to calculate the volume of various containers. A base class, Cylinder, will be created, with its derived classes, also called child classes or sub-classes. First, create a parent class, Cylinder. Create a constant for pi since you will need this for any non-square containers. Use protected for the members. Finally, create a public function that sets the volume. // The formula is: V = pi * (r^2) * h Task 2: Create...
Adam (A), Betsy (B) and Cathy (C) decided to form a partnership, which was founded on...
Adam (A), Betsy (B) and Cathy (C) decided to form a partnership, which was founded on 01/01/2015. Adam contributed cash $20,000 and inventory with market value of $30,000. B contributed a piece of land with market value of $80,000 with unpaid mortgage in the amount of $30,000. C contributed PPE with market value of $50,000 and C’s expertise is deemed to be worth of $50,000 by all the 3 partners. A: If ABC decided to use goodwill method to document...
write a c# program that: The file is using a very simple form of compression in...
write a c# program that: The file is using a very simple form of compression in which there are no spaces, each word is separated by camel casing. For Example, the string "TheCatWillRun" is parsed as "The Cat Will Run". *Now for the statistics* Prints to the console the following statistics about the content in the file retrieved above. - How many of each letter are in the file - How many letters are capitalized in the file - The...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT