Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 4: Calculating a Course Grade reference: Worked Example 5.2 B+,B,BC+,C,CD+,D,D or F) for each of them. The course grade is determined by dropping the

image text in transcribed

Exercise 4: Calculating a Course Grade reference: Worked Example 5.2 B+,B,BC+,C,CD+,D,D or F) for each of them. The course grade is determined by dropping the lowest grade and averaging the three remaining grades. To average grades, first convert them to numher grades, using the usual scheme A+=43.A=40.A=37B=33D=07F=0 Then compute their average and convert it back to the closest letter grade. For example, an average of 3.51 would be an A. Your task is to read inputs of the form: letterGradel letterGrade2 letterGrade3 letterGrade4 For example, AB+CA s For each input line, your output should be letterGrade where the letter grade is the grade eamed in the course, as just described. For example, A The end of inputs will be indicated by a letterGradel input of Q. Step 1: Carry out stepwise refinement. We will use the process of stepwise refinement. To process the inputs, we can process each line individually. Therefore, we declare a task Process line. To process a line, we read the first grade and bail out if it is a Q. Otherwise, we read the four grades. Because we need them in their numeric form, we identify a task Convert letter grade to number. We then have tour numbers and need to find the smallest one. I hat is another task, Find smallest of four numbers. To average the remaining ones, we compute the sum of all values, subtract the smallest and divide by three. Let's say that is not worth making into a subtask. Next, we need to convert the result back into a letter grade. That is yet another subtask. Convert number grade to letter. Finally, we print the letter grade. That is again so simple that it requires no subtask

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

Data Science Project Ideas In Health Care Volume 1

Authors: Zemelak Goraga

1st Edition

B0CPX2RWPF, 979-8223791072

More Books

Students also viewed these Databases questions

Question

Does it avoid use of underlining?

Answered: 1 week ago