Question: Java: A teacher included three extra credit questions on a test and awarded 3 extra points to students who answered all three questions correctly and

Java:

A teacher included three extra credit questions on a test and awarded 3 extra points to students who answered all three questions correctly and no extra points otherwise. The boolean variables extraOne, extraTwo, and extraThree indicate whether a student has answered the respective question correctly. Each variable would be assigned a value of true if the answer was correct and false if the answer was incorrect.

Which of the following code segments will correctly update the variable grade based upon a students answers to the extra credit questions?

I. if ( extraOne && extraTwo && extraThree ) grade += 3;

II. if ( extraOne || extraTwo || extraThree ) grade += 3;

III. if ( extraOne ) grade += 3;

if ( extraTwo ) grade += 3;

if ( extraThree ) grade += 3;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!