I did the code right but teacher said below it had indentation and braket issues
ID: 3862484 • Letter: I
Question
I did the code right but teacher said below it had indentation and braket issues. Can you please fix it.
Here is the code to make it easier
import java.util.Scanner;
public class Grade {
public static void main(String args[]) {
int score = 100;
Scanner object = new Scanner (System.in);
System.out.println("Enter a Score");
score = object.nextInt();
if(score >= 90){
System.out.println("Excellent you get an A");
}
else if (score >=80){
System.out.println("Good you get an B");
}
else if (score >=70){
System.out.println("Ok you get an C");
}
else if (score <=59){
System.out.println("F try harder");
}
else if (score <=69){
System.out.println("D try harder");
}
}
}
Explanation / Answer
import java.util.Scanner;
public class Grade
{
public static void main(String args[])
{
int score = 100;
Scanner object = new Scanner (System.in);
System.out.println("Enter a Score");
score = object.nextInt();
if(score >= 90)
{
System.out.println("Excellent you get an A");
}
else if (score >=80)
{
System.out.println("Good you get an B");
}
else if (score >=70)
{
System.out.println("Ok you get an C");
}
else if (score <=59)
{
System.out.println("F, try harder");
}
else if (score <=69)
{
System.out.println("D, try harder");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.