Hello John Swain,
I try to help you to explain what's wrong with your code:
1. you can't declare some other methods in a method.
2. you can't parse parameter(s) when you call a method, if the method doesn't provide it, e.g: in your getName() method, it doesn't provide parameter to be parsed, but when you called, you parsed a parameter, getName(name);
3. local variable can't be used to global, e.g in your main method, there are many global variables, and it just can be used in main method, if you want to use your local variable to another method, you can pass it in method's parameter(look at my code in getScore or getLetterGrade method). But don't forget with pass by value and pass by parameter in
java.
4. look at your code : keyboard.readline(). It suppose to be keyboard.readLine(). Don't forget, java is case sensitive.
5. you forget to close the braches, e.g in if (( finalScore >= 70) && ( < 80 ))
6. if (( finalScore >= 70) && ( < 80 )), it suppose to be if (( finalScore >= 70) && ( finalScore < 80 )) and others.
7. this is not a technical issue, but in method getLetterGrade(), i always found that the final score is less than 60 if the input range between 0 - 100

.
glad to help..
cmiiw..
here's the fixed code:
import java.io.*;
public class NewGradesProgram{
private static BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
public static void main(
String[] args) throws IOException{
//Section: Variables
String name;
int quiz1 = 0;
int quiz2 = 0;
double tMidTerm, tFinal, tQuiz;
int midTermExam = 0;
int finalExam = 0;
double finalScore = 0;
char grade;
name = getName();
quiz1 = getFirstQuiz();
quiz2 = getSecondQuiz();
midTermExam = getMidTermExam();
finalExam = getFinalExam();
finalScore = getScore(quiz1, quiz2, midTermExam, finalExam);
grade = getLetterGrade(finalScore);
System.out.println( "Student name: " + name );
System.out.println( "First quiz score: " + quiz1 );
System.out.println( "Second quiz score: " + quiz2 );
System.out.println( "Midterm Exam score: " + midTermExam );
System.out.println( "Final Exam score: " + finalExam );
System.out.println( "Final Score: " + finalScore );
System.out.println( "Your final grade is: " + grade );
} //End Method: main
//Method: get grades
private static String getName() throws IOException
{
System.out.println("Students calculated final scores");
System.out.println("and letter grades. ");
System.out.println("Please enter your name. ");
String name = keyboard.readLine();
return name;
}
//Method: get First Quiz
private static int getFirstQuiz() throws IOException
{
System.out.println("Please enter your first quiz grade. ");
int quiz1 = Integer.parseInt(keyboard.readLine());
return quiz1;
}
//Method: get Second Quiz
private static int getSecondQuiz() throws IOException
{
System.out.println("Please enter your second quiz grade. ");
int quiz2 = Integer.parseInt(keyboard.readLine());
return quiz2;
}
//Method: get Mid Term Exam
private static int getMidTermExam() throws IOException
{
System.out.println("Please enter your midterm exam grade. ");
int midTermExam = Integer.parseInt(keyboard.readLine());
return midTermExam;
}
//Method: get Final Exam
private static int getFinalExam() throws IOException
{
System.out.println("Please enter your finalexam grade. ");
int finalExam = Integer.parseInt(keyboard.readLine());
return finalExam;
}
//Method: Calculate Score
private static double getScore(int quiz1, int quiz2, int midTermExam, int finalExam)
{
double tQuiz = (((quiz1 + quiz2)/20)*.25);
double tMidTerm = ((midTermExam/100)*.25);
double tFinal = ((finalExam/100)*.50);
double finalScore = tQuiz + tMidTerm + tFinal;
return finalScore;
}
//Method: get letter grade
private static char getLetterGrade(double finalScore){
char grade = 'E';//assumption:if grade < 60 then grade E
if ( finalScore >= 90 )
{
grade = 'A';
}
else if (( finalScore >= 80) && ( finalScore < 90 ))
{
grade = 'B';
}
else if (( finalScore >= 70) && ( finalScore < 80 ))
{
grade = 'C';
}
else if (( finalScore >= 60) && ( finalScore < 70 ))
{
grade = 'D';
}
return grade;
}
}//End Class: gradesProgram