I'm very new to programming, I'm in an intermediate class and just barely passed the intro course. For my assignment I have to write 2 programs, the first one consists of creating a "student" class with instance variables called "lastName", "firstName" (both in String) and "score1, score2 and score3" in double. I have to create two methods, one displaying the average of the three scores and one for the final grade (in char). I've attempted the first half of the assignment, but when I tried to compile it, this error came up: "Exception in thread "main" java.lang.NoClassDefFoundError: c" along with a long chain of errors. I don't know why I'm getting these and any explanation/ suggestions on how to get my program to work would be great.
I also would have to create a second program showing how the class in my first program could be used, but I have no idea how to go about that.
Any help would be highly appreciated.
public class Student
{
public static void main(String[] args
{
String lastName, firstName;
Double score1, score2, score3;
Double averageScore;
Scanner keyboard = new Scanner (system.in);
System.out.print("Enter your last name: ");
lastName = keyboard.nextLine();
System.out.print("Enter your first name: ");
firstName = keyboard.nextLine();
System.out.print("Enter your first test score: ");
score1 = keyboard.nextDouble;
System.out.print("Enter your second test score: ");
score2 = keyboard.nextDouble;
System.out.print("Enter your third test score: ");
score3 = keyboard.nextDouble;
public static double averageScore(double score1, score2, score3){
averageScore = ((score1 + score2+ score3)/3);
if (averageScore < 0 || averageScore > 100)
{
System.err.println("Scores cannot be less than 0 or greater than 100.");
System.exit(1);
}
}
public static char finalGrade (double averageScore){
if (averageScore < 60) return 'F';
else if (averageScore < 70) return 'D';
else if (averageScore < 80) return 'C';
else if (averageScore < 90) return 'B';
else if (averageScore <= 100) return 'A';
else return 'I';
}
System.out.println(lastName+", "+ firstName);
System.out.println("Your test scores add up to: "+ averageScore);
System.out.println("Your grade is: " + finalGrade);
}
}
I also would have to create a second program showing how the class in my first program could be used, but I have no idea how to go about that.
Any help would be highly appreciated.