-1

//i just need the if statements at the bottom to work as well. right now I can only input the numeric grade and the gpa, but i need the accept or reject lines of code to print too.

 import java.util.Scanner;

    public class Main {

    public static void main(String[] args) throws Exception {
    Scanner scan = new Scanner(System.in);
        int studentGrade;
        float gradePointav;


        System.out.println("Please enter a your Numeric Grade:");{
        studentGrade = (int) System.in.read();}
        scan.nextLine();


        System.out.println("Please enter a GPA:");{
        gradePointav = (float) System.in.read();}
        scan.nextLine();


        if (gradePointav >= 3.0 && studentGrade >= 60) {
            System.out.println("You have been Accepted!");

        }

        if(gradePointav <= 3.0 && studentGrade <= 60)    {
            System.out.print("You have been rejected.");
        }


    }
    }

1 Answers1

0

Scanner next line method will return input from terminal:

public static void main(String[] args) throws Exception {
    Scanner scan = new Scanner(System.in);
    int studentGrade;
    float gradePointav;

    System.out.println("Please enter a your Numeric Grade:");
    studentGrade = scan.nextInt();

    System.out.println("Please enter a GPA:");
    gradePointav = scan.nextFloat();

    if (gradePointav >= 3.0 && studentGrade >= 60) {
      System.out.println("You have been Accepted!");
    } else if (gradePointav <= 3.0 && studentGrade <= 60) {
      System.out.print("You have been Rejected.");
    } else {
      System.out.println("You are not defined");
    }
  }
Akif Hadziabdic
  • 2,241
  • 1
  • 8
  • 20