Please help me with my code

java

#1

import java.util.Scanner;
public class IfDemo1
{
    public static void main(String[] args) {
       System.out.println("Enter your GPA on a 4.0 scale");
       
       Scanner in = new Scanner(System.in);
       double gpa = in.nextDouble;
         
        if( gpa >= 3.5 ){
         System.out.println("A");
         } else if ( gpa >= 3.0){
         System.out.println("B");
        } else if ( gpa >= 2.5){
         System.out.println("C");
        } else if ( gpa >= 2.0) {
         System.out.println("An D");
        } else if ( gpa > 0.0) {
         System.out.println("An F");
        }

        
       double test1, test2;
      
       System.out.println("Enter test1:");
       test1 = keysnextDouble();
       System.out.println("Enter test2:");
       test2 = keys.nextDouble();
      
       if (test1 > test2 ) System.out.println ("Test1 is bigger");
       else System.out.println("Test is equal or bigger");
      
    }
    
    public static int max(int a, int b) {
        
        if (a> b) return a;
        else return b;
    }
    
    public static double max(double a, double b) {
        if( b > a ) return b;
        else return a;
    }
        
}

#2

Please elaborate on your issue. What is the error you are getting ? Are you not getting the expected results?
This is essential for people who will try to help you.


#3

if you are getting a compilation error a good idea is to check these lines but first check the compliers error message


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.