i am sure that i am way off but i will attach the problem and hope someone can point me in the right direction. thanks in advance for any help given.
i am trying to created a program that will write a grading program for a class with the following policies

there are 2 quizzes each graded on the basis of 10 points
there is 1 midterm and 1 final each graded on 100 points
the final exam counts for 50% of the grade, the midterm counts for 25% and the 2 quizzes togehter count for a total of 25%(i have to normailze the scores)

letter grades based on
90-100 A
80-89 B
70-79 C
60-69 D
0-59 E
the program will read in the student's scores from a text file, and output the students record which will have the names 2 quiz, and 2 exam as well as the student's average numeric score for the enitre course.(all scores are intergers )
i want to use standard I/O
the following is the code i have come up with:

import javax.swing.*;
import java.util.*;
class lasthw {
 public static void main(String[] args){
     double quiz_1, quiz_2, midterm, finalExamGrade, average;
 
   final double QUIZ1_PERCENT = .125;
   final double QUIZ2_PERCENT = .125;
   final double MIDTERM_PERCENT = .25;
   final double FINALEXAM_PERCENT = .50;
 Scanner grades = new Scanner(System.in);

 String name, finalLetterGrade;
 while(grades.hasNext())
 { 
 quiz_1 = grades.next();
 quiz_2 = grades.next();
 midterm = grades.next();
 finalExamGrade = grades.next(); 
 
}
if(quiz_1 > 10 )
  System.out.println("ERROR quiz_1");
if(quiz_2 > 10 ) 
   System.out.println("ERROR quiz_2");
if(midterm > 100 )
   System.out.println("ERROR midterm");
if(finalExamGrade > 100)
   System.out.println("ERROR finalExamGrade ");

}
public static int operation(int op1, String op, int op2){
finalNumericGrade =
(quiz_1 * QUIZ1_PERCENT) +
(quiz_2  * QUIZ2_PERCENT) +
(midterm * MIDTERM_PERCENT) +
(finalExamGrade * FINALEXAM_PERCENT);
return finalNumericGrade;
}
 String letterGrade(){
if (finalNumericGrade >= 90)
finalLetterGrade = "A";
else
if ((finalNumericGrade >= 80) & (finalNumericGrade < 89))
finalLetterGrade = "B";
else
if ((finalNumericGrade >= 70) & (finalNumericGrade < 79))
finalLetterGrade = "C";
else
if ((finalNumericGrade >= 60) & (finalNumericGrade < 69))
finalLetterGrade = "D";
else
if (finalNumericGrade <= 59)
finalLetterGrade = "E";
return finalLetterGrade;
 
}
 
}
 
System.out.println(" Quiz 1 score = " + quiz_1 );
}
}

Insert code tags next time. ;) -'Stein

This article has been dead for over six months. Start a new discussion instead.