Answer:
import java.util.Scanner;
public class AdmissionModularized {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
//Prompt user for input
System.out.println("Please enter the gpa and test scores");
double gpa = in.nextDouble();
double testSCore = in.nextDouble();
// Call method admission() and pass the gpa and test score
System.out.println(admission(gpa, testSCore));
}
}
The Complete code with the defined method is given in the explanation section
Explanation:
import java.util.Scanner;
public class AdmissionModularized {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Please enter the gpa and test scores");
double gpa = in.nextDouble();
double testSCore = in.nextDouble();
System.out.println(admission(gpa, testSCore));
}
public static String admission(double gpa, double testScore){
if (gpa>=2.5 && testScore >=50){
return "Accept";
}
else{
return "Reject";
}
}
}
Note that the condition for ACCEPT and REJECT were not given in the question, we have assumed this to be (gpa>=2.5 && testScore >=50)