1.9 Write a program that will read the weight of a package of breakfast cereal in ounces and output the weight in metric tons as well as the number of boxes needed to yield one metric ton of cereal. In: A metric ton is 35,273.92 ounces.

Respuesta :

Answer:

Explanation:

//Header file section

#include<i ostream>

using namespace std;

#define MATRICTON 35273.92

//Begin main function

void main ()

{

//variable declaration

double ounceses,weight,boxes;

char choice;

do

      {

                //Inputing weight of ppackage

                cout<<" Enter weight of package in ounce: ";

                cin>>ounceses;

                //Calculating weight

               weight = (ounceses/MATRICTON);

                //Displaying the weight

               cout<<" weight of packet in metric tons is  "

                                                                         <<weight<<"\n";

                //Calculating boxes

                boxes = (MATRICTON/ounceses) ;

                //Displaying boxes

                cout<<" Number of boxes to make metric: ";

                                                                         <<boxes<<"\n";

               cout<<"Press y or Y to continue"<<endl;

                cin>>choice;

                while (choice == 'Y' || CHOICE == 'y' );

     }         weight = (ounceses/MATRICTON);

                //Pause system for a while

                                 system("pause");

}//End main function

Output:

Enter weight of packaged of breakfast cereal in ounce: 2654

weight of packet in metrictons is 0.0752397

Number of boxes to make metric: 13.2909

Press y or Y to continue

Enter weight of packaged of breakfast cereal in ounce: 5642

weight of packet in metrictons is 0.159948

Number of boxes to make metric: 6.25202

Press y or Y to continue

n

press any key to continue . . .