Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that assigns test score grades. The program's input should be a series of test scores of type int . Have the program

Write a program that assigns test score grades. The program's input should be a series of test scores of type int. Have the program read each score and print either the corresponding grade or an appropriate error message. The program is to continue until end-of-file. See Chapter 2 lecture notes or Figure 11.3, page 445 for instructions on simulating EOF (end-of-file) from the keyboard.

Assume the following grading scale:

9 - 10?A

8?B

7?C

6?D

0 - 5?F

Use a switch statement to assign or print the appropriate grade.

Run your program using the following input:

?1.?An invalid character

? - See the "Handling scanf Returning a Zero" handout.

? - Enter a valid score after the invalid character data to verify that the bad data was flushed.

2.?A negative value

3.?A value greater than 10

4.?All of the values between 0 and 10, inclusive

Turn in printouts of your program listing and the output. Make sure that your full name is on all of your printouts. Staple the assignment sheet to the top of your program.

As before, part of your grade will be based on the proper use of:

1. meaningful variable names

2. indentation

3. blank lines and spacing

4. comments on the following:

- program description

- all variable declarations

5. local variables (versus global variables)

6. format and appearance of output

7. structured code (e.g., no goto, break (except in a switch), continue, etc. statements)

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

1. Who will you assemble on the team?

Answered: 1 week ago