Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions