Write a program that accepts the letter grades for a student, calculates the student's gpa, and prints it out, along with one of the following five messages:
Eligible
Ineligible, taking less than 4 classes
Ineligible, gpa below 2.0
Ineligible, gpa above 2.0 but has F grade (note: gpa >= 2.0)
Ineligible, gpa below 2.0 and has F grade
2. Your program must use an appropriate sequence of nested if-else statements to print out the appropriate message.
3. The message "Ineligible, taking less than 4 classes" has priority over the other 3 ineligible cases.
4. The class will not ask the user for how many grades are in a student's report card. The program will continue to read grades until a non-grade character is input. At this point, some type of loop will cease and the program prints the GPA value and the eligibility message.
5. Example of run output: GPA = 3.75 Eligible
6. You do not have to print out any of the individual grades.
7. Your program should allow input of grades in either upper or lower case.
import java.util.Scanner; public class grades { /** * @param args * @return */ public static void main(String[] args); // TODO Auto-generated method stub Scanner in = new Scanner(System.in); double GPA=in.nextDouble(); System.out.println("GPA = "); if ( GPA == 4.0){ System.out.println("A"); }else{ if (GPA >=3.0 || < 4.0) System.out.println("B"); }else{ if (GPA >=2.0 || < 3.0) System.out.println("C"); }else{ if (GPA >=1.0 || < 2.0) System.out.println("D");} else { if (GPA == 0){ System.out.println("F"); }
iwas just wondering from my piece of code so far if this is correct and the syntax of my else if statements are also correct. i seem to have been getting stuck a very good amount of times so help is appreciated thank you