224k views
5 votes
One metric ton is approximately 2,205 pounds.

Write a program that prompts the user to input the amount of wheat, in pounds, a container can hold. The program outputs the number of containers needed to store one metric ton of wheat.

User Korpel
by
5.7k points

1 Answer

3 votes

Answer:

Here is the C++ program

#include <iostream>

using namespace std;

int main(){

double tonne = 2205;

double container_capacity;

cout << "Enter amount of wheat in pounds that a contained can hold: ";

cin >> container_capacity;

cout << "Number of containers needed to store one metric ton of wheat: " << tonne / container_capacity ; }

Step-by-step explanation:

  • In the body of main function, the first statement declares a double type variable tonne and assigns it a value of 2205 as it is given in the question that one metric ton is equal to 2205 pounds approx. Metric ton is also called tonne that's why i used tonne variable name in the program.
  • Next statement declares the variable container_capacity which stores the amount of wheat a container can hold.
  • Next the program prompts the user to enter amount of wheat that a container can hold.
  • Next statement stores that input value (amount of wheat that container can hold).
  • Last statement calculates and outputs the no. of containers required to store a tonne of wheat.
  • The formula divides the value of one tonne i.e. 2205 by the capacity of the container to get no. of containers required to store one tonne of wheat.
  • Suppose the container_capacity= 500
  • So number of containers needed to store one metric ton of wheat is

tonne / container_capacity = 2205/500 = 4.41

User Danise
by
6.0k points