/** * StudentGrades computes the grades of students in a class. * * @author (Andrew Samuels) * @version (02-18-2010) */ //import scanner import java.util.Scanner; public class StudentGrades { public static void main(String[] args) { //create variables int homeworkScore; int midtermScore; int finalexamScore; double finalcourseScore; //create scanner Scanner keyboard = new Scanner(System.in); //capture total homework score from user System.out.print("Please enter total homework score (0-200): "); homeworkScore = keyboard.nextInt(); //capture midterm score from user System.out.print("Please enter midterm score (0-100): "); midtermScore = keyboard.nextInt(); //capture final exam score from user System.out.print("Please enter final exam score (0-100): "); finalexamScore = keyboard.nextInt(); //determine final course score finalcourseScore = (50*(homeworkScore/200.0) + 20*(midtermScore/100.0) + 30*(finalexamScore/100.0)); //print final course score System.out.println("Final course score is: " + finalcourseScore); //determine letter grade and meaning of the grade if (finalcourseScore >= 90 && finalcourseScore <= 100) { System.out.println("Letter grade is: A"); System.out.println("You are: Distinctly above average"); } else if (finalcourseScore >= 80 && finalcourseScore < 90) { System.out.println("Letter grade is: B"); System.out.println("You are: Above average"); } else if (finalcourseScore >= 70 && finalcourseScore < 80) { System.out.println("Letter grade is: C"); System.out.println("You are: Average"); } else if (finalcourseScore >= 60 && finalcourseScore < 70) { System.out.println("Letter grade is: D"); System.out.println("You are: Below average"); } else if (finalcourseScore >= 0 && finalcourseScore < 60) { System.out.println("Letter grade is: E"); System.out.println("You are: Failed"); } } }
I am a software engineer with a computational physics focus. The purpose of this blog is to showcase my ideas and works. I can create value and reduce costs for your company.