# Help with a java program, I'm just learning...

• 10-11-2012, 10:21 PM
pittypatsfan
Help with a java program, I'm just learning...
I have a problem, I'm trying to write a program using loop and conditional statements that will calculate the overall grade of a student and produce the letter grade as well. I need to give 5 assignment grades, which it will take the highest 4 and get an average which is worth 25% of the grade. A score for the first exam which is worth 15% of the grade, a second exam grade also worth 15%, a lab grade worth 25% and a final exam grade worth 20%.
>=90 is A, >=80 but < 90 is B, >=70 but < 80 is C, >= 60 but < 70 D, and < 60 is F. So at the end it will say "The weighted average is" and produce a letter grade "You will receive a B" for example. Also it needs to have "Do you want to calculate for another student? Please type true or face. if True enter grades again, if false "bye" . Hopefully that makes sense, I am having problems and I'm not sure where to go... This is what I have so far........

import java.util.Scanner;

public static void main(String[] args) {

int f = (f > 0 && f < 59);
int d = (d >= 60 && d < 70);
int c = (c >= 70 && c < 80);
int b = (b >= 80 && b < 90);
int a = (a >= 90);

Scanner sc = new Scanner(System.in);

}
while ();
assignmentAverage = (total-lowest) / 4;

System.out.println("Do you want to calculate for another student? Please type true or false");

System.out.println("Bye, bye!");

}

}
• 10-12-2012, 04:46 AM
Junky
Re: Help with a java program, I'm just learning...
Code:

int f = (f > 0 && f < 59);
int d = (d >= 60 && d < 70);
int c = (c >= 70 && c < 80);
int b = (b >= 80 && b < 90);
int a = (a >= 90);

What exactly are you trying to do? The result of all the right hand side statements are booleans and yet you are trying to assign them to int variables.
Code: