Hi everyone,
I desperately need help, my assignment is:
Write a program that determines the grade for a class with the following grading criteria:
1. There are two quizzes (each worth 10 points)
2. There is one midterm exam and one final exam each worth 100 points.
3. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for the last 25 percent. Hint: the quiz scores should be converted to percents before they are averaged into the final grade).
Use the 90, 80, 70, 60 breaks for letter grades A, B, C, D. Anything below 60 is a F.
The program should read in the studentss scores and output the students information as shown below.
Define and use a class for the student record. The class shold have instance variables for the quizzes, midterm, final, overall numeric score for the course, and final letter grade. The class should have inpt and output methods. The input method should not ask for the final average or final letter grade but should have void methods that set the appropriate instance variables. Remember, one method can call another method.
Your program should have a reasonable set of accessor and mutator methods, whether or not hyouor program uses them. Of course you can add additonal methods if you like.
Required Statements: methods, encapsulation, constructors, accessors
Sample Output:
Student Quiz 1 Quiz2 MidTerm Final Final % Grade
1 8 7 89 94 88 B
2 9 6 77 90 83 B
3 10 10 65 88 85 B
4 7 5 80 81 75.5 C
There is a file that comes with the program and it looks like this:
8 7 89 94
9 6 77 90
10 10 65 88
7 5 80 81
The code I have so far is:
Please help me. I don't know what to do next.
I desperately need help, my assignment is:
Write a program that determines the grade for a class with the following grading criteria:
1. There are two quizzes (each worth 10 points)
2. There is one midterm exam and one final exam each worth 100 points.
3. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for the last 25 percent. Hint: the quiz scores should be converted to percents before they are averaged into the final grade).
Use the 90, 80, 70, 60 breaks for letter grades A, B, C, D. Anything below 60 is a F.
The program should read in the studentss scores and output the students information as shown below.
Define and use a class for the student record. The class shold have instance variables for the quizzes, midterm, final, overall numeric score for the course, and final letter grade. The class should have inpt and output methods. The input method should not ask for the final average or final letter grade but should have void methods that set the appropriate instance variables. Remember, one method can call another method.
Your program should have a reasonable set of accessor and mutator methods, whether or not hyouor program uses them. Of course you can add additonal methods if you like.
Required Statements: methods, encapsulation, constructors, accessors
Sample Output:
Student Quiz 1 Quiz2 MidTerm Final Final % Grade
1 8 7 89 94 88 B
2 9 6 77 90 83 B
3 10 10 65 88 85 B
4 7 5 80 81 75.5 C
There is a file that comes with the program and it looks like this:
8 7 89 94
9 6 77 90
10 10 65 88
7 5 80 81
The code I have so far is:
import java.util.Scanner;
import java.io.*;
class FinalGrades
{
public static void main(String args[])
{
try
{
FileReader data = new FileReader("data.dat");
BufferedReader numBuffer = new BufferedReader(data);
Scanner numScan = new Scanner(numBuffer);
int student = 1;
System.out.print("Student\tQuiz 1\tQuiz 2\tMidTerm\tFinal\tFinal %\tGrade\n");
System.out.print(student+"\t");
while(numScan.hasNextInt())
{
int n = numScan.nextInt();
if(student<5)
{
System.out.print(n+"\t");
}
student++;
}
numScan.close();
}
catch (Exception e)
{
System.err.println("Error");
}
}
static void Grading()
char grade = "";
{
if(finalGrade >=90)
{
grade = "A"
}
else if(finalGrade >=80)
{
grade = "B"
}
else if(finalGrade >=70)
{
grade = "C"
}
else if(finalGrade >=60)
{
grade = "D"
}
else if(finalGrade <=60)
{
grade = "F"
}
}
}
Please help me. I don't know what to do next.