EBK C HOW TO PROGRAM
EBK C HOW TO PROGRAM
8th Edition
ISBN: 9780133964639
Author: Deitel
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
Question
Book Icon
Chapter 4, Problem 4.22E
Program Plan Intro

Program plan:

  1. Declare the counter variables for each letter grade, the total counter and the total value of all the grades.
  2. Prompt the user to enter the letter grades.
  3. Declare a WHILE loop in order to continue the process until the user enters the exit character.
  4. The SWITCH statement is used in order to increase the counter of the corresponding letter grades.
  5. Increase the letter grade counter and the total grade counter by one each time and add the value or mark of the grade.
  6. After the user enters the exit character, divide the total value by the count of grades entered in order to obtain the average mark.
  7. Using IF conditions, determine the grade corresponding to the average mark.

Summary Introduction:

To modify the program provided in fig 4.7 to print the average letter grade of the class based on entered letter grades.

Program description:

The main purpose of this program is to take the user entered values for the letter grades of a class and to determine the average grade of the class based on those letters. The program uses a SWITCH statement to count the number of occurrences of each grade and thereafter, it determines the average grade with the help of IF conditions.

Blurred answer
Students have asked these similar questions
What is the output of the following program! *
How should I answer the following regarding the first main function?
State whether each of the following is true or false. If false, explain why e) All variables must be given a type when they’re defined.

Chapter 4 Solutions

EBK C HOW TO PROGRAM

Knowledge Booster
Background pattern image
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning