(Solved) : C Class Topics Branches Statement Else Statement Description Write Program Determine Wheth Q40113499 . . .

c++ class

Topics

Branches

if statement

if/else statement

Description

Write a program that will determine whether the user passed orfailed a test. The program will ask the user to input thefollowing:

Maximum Test Score – the maximum total scores in the test.

Percent Pass Score – the minimum percent scores required to passthe test.

User Test Score – the actual scores obtained by the user in thetest.

From the above input values, the program will compute the userpercent score. It will compare the percent user score with thepercent pass score. If the percent user score is equal to orgreater than the percent pass score, the program will consider theuser having passed the test. Otherwise, the program will considerthe user having failed the test. At the end, the program willdisplay the result summary. See the Test section below.

Testing

Perform the test run 1 and the test run 2 below with the datashown below.

(User input is shown in bold.)

(It’s OK if your decimal values don’t look the same as below solong as they are equal)

Test Run 1

Enter Maximum Test Score:

400

Enter Percent Pass Score:      

80

Enter User Test Score:

324

Result Summary

Test Result: Pass

User Test Score: 324

User Percent Score: 81.0 %

Maximum Score: 400

Percent Pass Score: 80.0 %

Test Run 2

Enter Maximum Test Score:

400

Enter Percent Pass Score:      

80

Enter User Test Score:

316

  

Result Summary

Test Result: Fail

User Test Score: 316

User Percent Score: 79.0 %

Maximum Score: 400

Percent Pass Score: 80.0 %

Submit

Copy the following in a file and submit that file.

Output of test runs.

All the C/C++ source code.

Sample Code

// declare variables

double maxScore, pctPassScore, userScore, pctUserScore;

//write code to input maxScore, pctPassScore, userScore

//determine pctUserScore

pctUserScore = (userScore / maxScore) * 100.0

//determine test result

cout << “Result Summary” << endl << endl;

if (pctUserScore >= pctPassScore) {

    cout << “Test Result: Pass” <<endl;

}

else {

    cout << “Test Result: Fail” <<endl;

}

Expert Answer


Answer to c++ class Topics Branches if statement if/else statement Description Write a program that will determine whether the us…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us

× How can I help you?