Question

Help on coding this in c++. I am confused as how to go about this problems!

IZzes 1. (Metric - English units Conversion) nferences A metric ton is 35,273.92 ounces. Write a C++ program to read the weig

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Screenshot

Ouck Launch ICb+) ThrCuestions lnCop Microsct Visual Studio View Pmjert Ruild Dehu Team Tocls deepthionganattu D File Feit TaProgram

//Header files for I/O
#include <iostream>
using namespace std;
//Function prototypes
void ouncestoMetrictons();
void retroActivePay();
void couponCount();
int main()
{
   //Call 3 functions
   ouncestoMetrictons();
   retroActivePay();
   couponCount();
}
/*
Name:ouncestoMetrictons
precondition:None
postcondition:None
Description: Take ounces from user calculate metric tons and number of boxes for matric tons
*/
void ouncestoMetrictons() {
   double ounces;
   cout << "Enter weight of a cereal box in ounces: ";
   cin >> ounces;
   double metricTons = ounces / 35273.92;
   cout << ounces<<" ounces = "<<metricTons<<" metrictons" << endl;
   double numOfBoxes = 35273.92 / ounces;
   cout << "Yield of boxes = " << numOfBoxes << endl;
}

/*
Name:retroActivePay
precondition:None
postcondition:None
Description:Take previous annual salary,calculate new annual,monthly and retro active salaries
*/
void retroActivePay() {
   double preSalary, retroSalary, newSalary,newMonthlySalary;
   cout << endl;
   cout << "Enter your previous salary: ";
   cin >> preSalary;
   newSalary = (preSalary * (1+.076));
   newMonthlySalary = newSalary / 12;
   retroSalary = (preSalary / 2) * .076;
   cout << "Annual salary is: $" << newSalary << endl;
   cout << "Receive $" << retroSalary << " in retroactive salary." << endl;
   cout << "Monthly salary is: $" << newMonthlySalary << endl;
}

/*
Name:couponCount
precondition:None
postcondition:None
Description:Take number of coupons you won, then caculate how much candy and gum balls get by using this coupon
*/
void couponCount() {
   cout << endl;
   int numCoupons;
   cout << "Enter the number of coupons you win: ";
   cin >> numCoupons;
   int numCandy= numCoupons / 10;
   int numGumballs = (numCoupons % 10)/3;
   cout << "Number of candies = " << numCandy << " and number of gumballs = " << numGumballs << endl;
}

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

output

Enter weight of a cereal box in ounces: 14
14 ounces = 0.000396894 metrictons
Yield of boxes = 2519.57

Enter your previous salary: 5000
Annual salary is: $5380
Receive $190 in retroactive salary.
Monthly salary is: $448.333

Enter the number of coupons you win: 29
Number of candies = 2 and number of gumballs = 3

Add a comment
Know the answer?
Add Answer to:
Help on coding this in c++. I am confused as how to go about this problems!...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT