Help on coding this in c++. I am confused as how to go about this problems!
Screenshot
Program
//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
Help on coding this in c++. I am confused as how to go about this problems!...