Results 1 to 8 of 8
- 05-09-2011, 12:43 PM #1
Member
- Join Date
- May 2011
- Posts
- 3
- Rep Power
- 0
Please help - can't seem to correct this...
Hi, I'm new to Java and I'm having trouble debugging this applet that I have. Can someone please help me. Everytime I debiug it, I ran into errors. Thanks.
It's a program to create a table of grades for a class.
// This program creates a table of grades for a class
import java.util.*;
public class Class{ Grades
{ // This Program will create a table of grades for a class.
public static void main(String[] args)
{
int Grade, Points, Students;
double Percent;
// User input three initials
String initials = input.next();
System.out.printf(String "Initials is %s Points is %d Percent is %f Grade is %c, Initials, Points, Percent, Grade);
Scanner input = new Scanner(System.in);
// Tell user what this program does
System.out.print ("This program creates grades for a class");
// Ask user how many students are in the class
System.out.print ("How many students are in the class?");
Students = input.nextInt();
// Tell user to input total number of points
Points = input.nextInt();
int[] klist = new int[<F11>
Class Average =
if (Grade >= 90); { {
Grade = "A";}
else if (Grade >= 80) {
Grade = "B";}
else if (Grade >= 70) {
Grade = "C";}
else if (Grade >= 60) {
Grade = "D";}
else if (Grade < 60); {
Grade = "F";}
} // end of main method
} // end of class
- 05-09-2011, 01:10 PM #2
Senior Member
- Join Date
- Mar 2011
- Posts
- 261
- Rep Power
- 3
Copy and paste the exact errors that you receive.
- 05-09-2011, 01:19 PM #3
Also, edit your first post to put the code between code tags.
- 05-09-2011, 01:29 PM #4
Member
- Join Date
- May 2011
- Posts
- 3
- Rep Power
- 0
Thanks for your reply...here it is (with errors)
// This program creates a table of grades for a class
import java.util.*;
public class Class{ Grades
{ // This Program will create a table of grades for a class.
public static void main(String[] args)
{
int Grade, Points, Students;
double Percent;
// User input three initials
String initials = input.next();
System.out.printf(String "Initials is %s Points is %d Percent is %f Grade is %c, Initials, Points, Percent, Grade);
Scanner input = new Scanner(System.in);
// Tell user what this program does
System.out.print ("This program creates grades for a class");
// Ask user how many students are in the class
System.out.print ("How many students are in the class?");
Students = input.nextInt();
// Tell user to input total number of points
Points = input.nextInt();
int[] klist = new int[<F11>
Class Average =
if (Grade >= 90); { {
Grade = "A";}
else if (Grade >= 80) {
Grade = "B";}
else if (Grade >= 70) {
Grade = "C";}
else if (Grade >= 60) {
Grade = "D";}
else if (Grade < 60); {
Grade = "F";}
} // end of main method
} // end of class
**** HERE IS THE ERROR REPORT
ClassGrades.java:43: 'else' without 'if'
} else if (Points >= 80) {
^
ClassGrades.java:52: reached end of file while parsing
} // end of class
^
- 05-09-2011, 01:29 PM #5
Member
- Join Date
- May 2011
- Posts
- 3
- Rep Power
- 0
Sorry for asking this, what do you mean by code tags?
- 05-09-2011, 01:32 PM #6
Put [ code] and [ /code] (without the spaces) at the start and end of your code. It preserves your indentations and makes the code much easier to read.
- 05-09-2011, 01:34 PM #7
Also, I think I've found your error: if (Grade >= 90); { { Why two {? Also, don't put ; after if, or the if does nothing.
EDIT: Or at least one of the problems. I think you'll get some other errors once you fix that.Last edited by Toll; 05-09-2011 at 01:36 PM.
- 05-09-2011, 01:39 PM #8
Similar Threads
-
keyTyped is it correct
By aizen92 in forum New To JavaReplies: 18Last Post: 04-03-2011, 01:47 PM -
How to compute or know the correct value for Xmx and xms?
By icesnake in forum New To JavaReplies: 5Last Post: 06-08-2010, 04:22 PM -
Are my comments correct?
By twiggy62 in forum New To JavaReplies: 2Last Post: 02-08-2010, 05:34 AM -
Getting correct output
By WarmRegards in forum New To JavaReplies: 9Last Post: 11-01-2009, 04:41 PM -
Is this the correct Output?
By Teny in forum New To JavaReplies: 17Last Post: 04-13-2009, 12:52 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks