Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8. Consider the following code segments, which are each intended to convert grades from a 100-point scale to a 40-point scale and print the
8. Consider the following code segments, which are each intended to convert grades from a 100-point scale to a 40-point scale and print the result. A grade of 90 or above should yield a 4.0, a grade of 80 to 89 should yield a 3.0, a grade of 70 to 79 should yield a 2.0, and any grade lower than 70 should yield a 0.0. Assume that grade is an int variable that has been properly declared and initialized. double points 0.0: if (grade > 89: points + 4.0; else if (grade > 79) points += 3.0; else if (grade > 69) else points += 2.0; points += 0.0: System.out.println(points): Code Segment I (A) The two The two (B) 80. (C) The two (1) Both co- (E) The twa Code Segment II double points 0.0: if (grade > 89: points + 4.0; if (grade > 79! grade += 3.0; if (grade > 69: points += 2.0; if (grade < 70: points += 0.0; } System.out.println (points); Which of the following statements correctly compares the values printed by the two methods?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started