I get the following error when running the code below, can someone help me fix i
ID: 3589387 • Letter: I
Question
I get the following error when running the code below, can someone help me fix it please
C:UsersMichaelDesktopGradeTester.java:45: error: reached end of file while parsing
}
^
1 error
Tool completed with exit code 1
import java.util.Scanner;
public class GradeTester {
public static void main(String[] args) {
// Declaring variables
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
int grammer, spelling, correctlen, content;
// Create an instance of Eassy
Eassy compitition = new Eassy();
while (true) {
System.out.print("Enter Points for Grammer :");
grammer = sc.nextInt();
System.out.print("Enter Points for Spelling :");
spelling = sc.nextInt();
System.out.print("Enter Points for Correct Length :");
correctlen = sc.nextInt();
System.out.print("Enter Points for Content :");
correctlen = sc.nextInt();
compitition.setGrammar(grammer);
compitition.setSpelling(spelling);
compitition.setCorrectLength(correctlen);
compitition.setContent(content);
// Getting the character from the user 'Y' or 'y' or 'N' or 'n'
System.out.print("Do you want to continue(Y/N) ::");
char ch = sc.next(".").charAt(0);
if (ch == 'Y' || ch == 'y')
continue;
else {
System.out.println(":: Program Exit ::");
break;
}
}
Explanation / Answer
//Now check this
import java.util.Scanner;
public class GradeTester {
public static void main(String[] args) {
// Declaring variables
/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);
int grammer, spelling, correctlen, content;
// Create an instance of Eassy
Eassy compitition = new Eassy();
while (true) {
System.out.print("Enter Points for Grammer :");
grammer = sc.nextInt();
System.out.print("Enter Points for Spelling :");
spelling = sc.nextInt();
System.out.print("Enter Points for Correct Length :");
correctlen = sc.nextInt();
System.out.print("Enter Points for Content :");
correctlen = sc.nextInt();
compitition.setGrammar(grammer);
compitition.setSpelling(spelling);
compitition.setCorrectLength(correctlen);
compitition.setContent(content);
// Getting the character from the user 'Y' or 'y' or 'N' or 'n'
System.out.print("Do you want to continue(Y/N) ::");
char ch = sc.next(".").charAt(0);
if (ch == 'Y' || ch == 'y')
continue;
else {
System.out.println(":: Program Exit ::");
break;
}
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.