Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions