C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
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
7: Exams.cpp) Suppose a teacher weights the four exams he gives 10%, 25%, 30%, and 35%. Write a program that reads ten sets of four grades, prints the weighted average of each set, and prints the unweighted average of each test. The number of students should be in a global constant.
C program of When the direction of the sun makes an angle of 35.2° with the horizontal, an oil derrick casts a shadow of 150 ft. How high the derrick is?
Trigonometry: The basic MATLAB trigonometric functions are sin, cos, tan, cot, sec, and csc. The inverses, e.g., arcsin, arctan, etc., are cal- culated with asin, atan, etc. The same is true for hyperbolic functions. The inverse function at an2 takes two arguments, y and x, and gives the four- quadrant inverse tangent. The argument of these functions must be in radians. Calculate the following quantities: sin, cost, and tan. sin²+ cos². (Typing sin^2(x) for sin²x will produce an error). y cosh²z-sinh² x, with x = 32m.

Chapter 4 Solutions

C How to Program (8th Edition)

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education