EBK C HOW TO PROGRAM
8th Edition
ISBN: 9780133964639
Author: Deitel
Publisher: PEARSON CUSTOM PUB.(CONSIGNMENT)
expand_more
expand_more
format_list_bulleted
Question
Chapter 4, Problem 4.22E
Program Plan Intro
- Declare the counter variables for each letter grade, the total counter and the total value of all the grades.
- Prompt the user to enter the letter grades.
- Declare a WHILE loop in order to continue the process until the user enters the exit character.
- The SWITCH statement is used in order to increase the counter of the corresponding letter grades.
- Increase the letter grade counter and the total grade counter by one each time and add the value or mark of the grade.
- After the user enters the exit character, divide the total value by the count of grades entered in order to obtain the average mark.
- 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.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents 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
Ch. 4 - Find the error in each of the following. (Note:...Ch. 4 - State which values of the control variable x are...Ch. 4 - Write for statements that print the following...Ch. 4 - Prob. 4.8ECh. 4 - (Sum a Sequence of Integers) Write a program that...Ch. 4 - (Average a Sequence of Integers) Write a program...Ch. 4 - (Find the Smallest) Write a program that finds the...Ch. 4 - (Calculating the Sum of Even Integers) Write a...Ch. 4 - (Calculating the Product of Odd Integers) Write a...Ch. 4 - (Factorials) The factorial function is used...
Ch. 4 - (Modified Compound-Interest Program) Modify the...Ch. 4 - (Triangle-Printing Program) Write a program that...Ch. 4 - (Calculating Credit Limits) Collecting money...Ch. 4 - (Bar-Chart Printing Program) One interesting...Ch. 4 - (Calculating Sales)An online retailer sells five...Ch. 4 - (Truth Tables) Complete the following truth tables...Ch. 4 - Rewrite the program of Fig. 4.2 so that the...Ch. 4 - Prob. 4.22ECh. 4 - (Calculating the Compound Interest with...Ch. 4 - Assume i=1,j=2,k=3andm=2. What does each of the...Ch. 4 - (Table of Decimal, Binary, Octal and Hexadecimal...Ch. 4 - (Calculating the Value of )Calculate the value of...Ch. 4 - Prob. 4.27ECh. 4 - (Calculating Weekly Pay)A company pays its...Ch. 4 - (De Morgans Laws)In this chapter, we discussed the...Ch. 4 - (Replacing switch with if ... else)Rewrite the...Ch. 4 - (Diamond-Printing Program)Write a program that...Ch. 4 - (Modified Diamond-Printing Program)Modify the...Ch. 4 - (Roman-Numeral Equivalent of Decimal Values)Write...Ch. 4 - Describe the process you would use to replace a do...Ch. 4 - A criticism of the break statement and the...Ch. 4 - Prob. 4.36ECh. 4 - Describe in general how you would remove any...Ch. 4 - (The Twelve Days of Christmas Song) Write a...Ch. 4 - (Limitations of Floating-Point Numbers for...Ch. 4 - (World Population Growth) World population has...Ch. 4 - (Tax Plan Alternatives; The FairTax) There are...
Knowledge Booster
Similar questions
- State whether each of the following is true or false. If false, explain why g) Definitions can appear anywhere in the body of a function.arrow_forwardState whether each of the following is true or false. If false, explain why.a) Function printf always begins printing at the beginning of a new linearrow_forwardWhat is wrong in the following function?arrow_forward
- Derive the run time of the following codearrow_forwardState whether each of the following is true or false. If false, explain why h) All arguments following the format control string in a printf function must be preceded by an ampersand (&).arrow_forward-Convert SES variable to a factor and assign the value labels “low”, ”middle” and “high” to the 3 levels of thevariable. Then -Define the variables complic, comorb, depressi, diabetes as factors. For all these factors, a zero means “no” and a 1 means “yes”. Assign these value labels through the function factor() and check the change using str()arrow_forward
- Using your own words, please describe what a function is. Defend your statements with a concrete illustration.arrow_forward- Give an example of short circuit evaluation (in any language) and explain why it is short circuited - Give an example of an overloaded operator (in any language – but not overloaded by a function). Explain why it is overloaded.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning