Read the following code. For each of the provided example values of category tha
ID: 3871455 • Letter: R
Question
Read the following code. For each of the provided example values of category that might be entered by a user, indicate the final values for rate and total. 5. int rate 20; double total = 100.0; printfC Enter the letter of your category: scanf(" %c", &category; switch (category) case ‘M' : rate = rate + 1; case ‘F' : total = rate * 2; case ‘h' : break; ‘D' (int) (total )/8) ; rate break; case : = default : total= total + rate; break; Sample valuc for category Final valuc of rate is: Final value of total is: H' G'Explanation / Answer
No break after 'M'
total = rate*2 = 42
No break after 'H' so control goes to next case 'D'
rate = (int)(100/8) = 12
Sample value for category Final value of rate is: Final value of total is: 'M' rate = 20 + 1 = 21No break after 'M'
total = rate*2 = 42
'H'No break after 'H' so control goes to next case 'D'
rate = (int)(100/8) = 12
total = 100 'G' rate = 20 total = 100+20 = 120Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.