Question: Please kindly fix my code - I cannot figure out how to fix it! Problem: Write a program that prompts a student to enter a

Please kindly fix my code - I cannot figure out how to fix it!

Problem: Write a program that prompts a student to enter a Java score. If the score is greater or equal to 60, display "you pass the exam"; otherwise, display "you don't pass the exam". Your program ends with input = -1.

Here is my work so far, please feel free to work from scratch!

import java.util.Scanner; public class Exercise05_01 { public static void main(String[] args) { // Create a scanner Scanner input = new Scanner(System.in);

System.out.println("Enter your score: "); int score = input.nextInt(); while (score != -1) { if (score >= 60) { System.out.println("You pass the exam. "); } else { System.out.println("You don't pass the exam. "); } if (score < 0) { System.out.println("No numbers are entered except 0"); break; } } } }

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!