Question: In this lab you will be enhancing the grade calculating program developed in Lab 14: #include using namespace std; void displayMenu(){ cout < >n; switch(n){

In this lab you will be enhancing the grade calculating program developed in Lab 14:

#include

using namespace std;

void displayMenu(){

cout<<" 1. Fahrenheit to Celsius 2. Miles to kilometers 3. Liters to Gallons 4. Exit from the program ";

}

double fahrenheitToCilsuis(double fTemp){

return (fTemp-32)*5/9;

}

double milesToKilometers(double miles){

return miles/0.62137;

}

double litersToGallons(double liters){

return liters*0.264172;

}

int main() {

int n;

do{

displayMenu();

cin>>n;

switch(n){

case 1:

double Fahrenheit,celcius;

cout<<"Enter temprature: ";

cin>>Fahrenheit;

celcius=fahrenheitToCilsuis(Fahrenheit);

cout<

break;

case 2:

double miles,Kms;

cout<<"Enter miles: ";

cin>>miles;

Kms=milesToKilometers(miles);

cout<

break;

case 3:

double liters,gallons;

cout<<"Enter liters: ";

cin>>liters;

gallons=litersToGallons(liters);

cout<

break;

case 4:

exit(0);

break;

default:

cout<<"Wrong choice";

}

}while(n!=4);

}

Just like the previous one, two tests scores and one homework score will be supplied by the user from the console, and the student's total score and final grade will be calculated and output to the console. However, this time you are going to focus on reading the test and homework scores. First, you'll need to write these

the following function:

1) readTestandHwScore: This function is a void-function function whose purpose is to ask the user

to enter the two test scores and the hw score for the student and update corresponding variables

in main.

Hint: you should pass your parameters by reference for the three parameters so that their new values will be

returned to the main function. The prototype will look like this:

void readTestandHwScore (double &test1Score, double &test2Score, double &hwScore);

Lastly, call this function from the main program and make sure that the test and homework scores

receive their values properly.

IMPORTANT NOTE: No global variables are allowed! In other words, each function should have its own

local variables (or parameters) to handle test and homework scores.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!