You have been hired by a small college to help automate their admission process.
ID: 3673141 • Letter: Y
Question
You have been hired by a small college to help automate their admission process. The college has three schools -- Engineering, Liberal Arts, and Fine Arts. Each school has different entrance requirements and uses different criteria to select applicants. This makes it difficult to determine whether to Admit, Defer, or Deny each applicant. Having the necessary logic incorporated into a computer program will make this process much easier and help eliminate human error.
For this project, you will write a program named Admissions that automates the admission selection process for a college. The college has a three schools — Engineering, Liberal Arts, and Fine Arts. All applicants submit an essay that is given a score ranging from 1 to 4. Applicants to the Engineering and Liberal Arts schools provide critical Reading and Math SAT scores while the Fine Arts applicants submit a portfolio instead — each portfolio is rated as Excellent, Good, Fair, or Poor. Based on the specific criteria listed below for each school, each applicant is given an admission status of "Admit", "Defer", or "Deny". However, applicants with an admission status of "Defer" who have two or more Alumni family members will be upgraded to "Admit" status.
Applicants with an essay score less than 2, a Math SAT score below 500, or a Reading SAT score below 400 will receive a "Deny" status. Other applicants who have a Math SAT score of 700 or better and a Reading SAT score of 600 or better will receive an "Admit" status while those with a Math SAT score of 500 or better and a Reading SAT score of 400 or better will receive a "Defer" status.
Applicants with an essay score less than 3, a Math SAT score below 400, or a Reading SAT score below 500 will receive a "Deny" status. Other applicants who have a Math SAT score of 500 or better and a Reading SAT score of 650 or better will receive an "Admit" status while those with a Math SAT score of 400 or better and a Reading SAT score of 500 or better will receive a "Defer" status.
Applicants with an essay score less than 2, or a Portfolio rating of "Poor" or "Fair" will receive a "Deny" status. Other applicants who have a Portfolio rating of "Excellent" will receive an "Admit" status while those with a Portfolio rating of "Good" will receive a "Defer" status.
Your program must display a header that lists the name of the application and provides instructions about using the program. For example,
The user should be prompted for the following input values:
The program should then output the applicant's admission status of Admit, Defer, or Deny.
Here are some examples; you must prompt the user for the input values in the same order as shown in the examples:
If the user enters an invalid school, an essay score below 1 or greater than 4, an SAT score below 200 or greater than 800, an invalid portfolio rating, or a negative integer for the number of alumni family members, the program should print "Invalid input" and immediately quit. HINT: The statement System.exit(1); will cause the program to quit with a status of 1 indicating an error condition. NOTE that you do not need to handle the situation where the user enters something other than an integer when an integer is expected. We will learn to handle this later in the semester.
Here are several examples of handling invalid input:
The program must contain and use the completed version of the getAdmissionStatus() method below. You are free to define and use additional methods, if you like; be sure to provide Javadoc for them and include them in your structure diagram. Replace the comments below with appropriate Javadoc.
Even though you should do thorough error checking of the input values and exit the program as soon as an invalid value is entered, you must also do error checking of the parameter values within the getAdmissionStatus() methodand throw an IllegalArgumentException(), if any parameter value is invalid as described below. This requirement is simply to give you practice in checking method parameters and throwing exceptions.
Explanation / Answer
import java.util.Scanner;
public class Admissions{
static String getAdmissionStatus(String school, double essay, double math, double reading, String portfolio){
String status = null;
if(school.equalsIgnoreCase("E")){
if(essay < 2 || math < 500 || reading < 400){
status = "Deny";
}
else if(math >= 700 && reading >= 600){
status = "Admit";
}
else if(math >= 500 || reading >= 400){
status = "Defer";
}
}
else if(school.equalsIgnoreCase("L")){
if(essay < 3 || math < 400 || reading < 500){
status = "Deny";
}
else if(math >= 500 && reading >= 650){
status = "Admit";
}
else if(math >= 400 || reading >= 500){
status = "Defer";
}
}
else if(school.equalsIgnoreCase("F")){
if(essay < 2 || portfolio.equalsIgnoreCase("P") || portfolio.equalsIgnoreCase("F")){
status = "Deny";
}
else if(portfolio.equalsIgnoreCase("E")){
status = "Admit";
}
else if(portfolio.equalsIgnoreCase("G")){
status = "Defer";
}
}
return status;
}
public static void main(String args[]){
System.out.println("Welcome to the College Admissions Program! When prompted, please enter the applicant's name, the school to which he/she is applying - E (Engineering), L (Liberal Arts), or F (Fine Arts), and the applicant's essay score. Depending on the school, enter the Math/Reading SAT scores or the Portfolio rating - E (Excellent), G (Good), F (Fair), or P (Poor). Also, enter the number of alumni family members. The applicant's admission status of Admit, Defer, or Deny will then be displayed ");
Scanner in = new Scanner(System.in);
System.out.print("Applicant Name: ");
String name = in.nextLine();
System.out.print("E (Engineering), L (Liberal Arts), or F (Fine Arts): ");
String school = in.next();
if(!school.equalsIgnoreCase("E") && !school.equalsIgnoreCase("L") && !school.equalsIgnoreCase("F")){
System.out.println("Invalid input");
System.exit(1);
}
String status = null;
if(school.equalsIgnoreCase("E")){
System.out.print("Essay score (1-4): ");
double essay = in.nextDouble();
if(essay < 0 || essay > 4){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Math SAT score (200-800): ");
double math = in.nextDouble();
if(math < 200 || math > 800){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Reading SAT score (200-800): ");
double reading = in.nextDouble();
if(reading < 200 || reading > 800){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Number of alumni family members: ");
int numAlumni = in.nextInt();
status = getAdmissionStatus("E", essay, math, reading, "");
}
if(school.equalsIgnoreCase("L")){
System.out.print("Essay score (1-4): ");
double essay = in.nextDouble();
if(essay < 0 || essay > 4){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Math SAT score (200-800): ");
double math = in.nextDouble();
if(math < 200 || math > 800){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Reading SAT score (200-800): ");
double reading = in.nextDouble();
if(reading < 200 || reading > 800){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Number of alumni family members: ");
int numAlumni = in.nextInt();
status = getAdmissionStatus("L", essay, math, reading, "");
}
if(school.equalsIgnoreCase("F")){
System.out.print("Essay score (1-4): ");
double essay = in.nextDouble();
if(essay < 0 || essay > 4){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Portfolio rating (E (Excellent), G (Good), F (Fair), or P (Poor)): ");
String portfolio = in.next();
if(!portfolio.equalsIgnoreCase("E") && !portfolio.equalsIgnoreCase("G") && !portfolio.equalsIgnoreCase("F") && !portfolio.equalsIgnoreCase("P")){
System.out.println("Invalid input");
System.exit(1);
}
System.out.print("Number of alumni family members: ");
int numAlumni = in.nextInt();
status = getAdmissionStatus("F", essay, 0, 0, portfolio);
}
System.out.println("Admission Status: " + status);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.