using java programing Write a program that compares two college applicants. The
ID: 3637736 • Letter: U
Question
using java programingWrite a program that compares two college applicants. The program should prompt for each
student’s GPA, SAT, and ACT exam scores and report which candidate is more qualified on the
basis of these scores.
For SAT Scores:
(2 ?*verbal * math)/24
For ACT Scores:
(2*reading * English * math * science)/1.8
These formulas produce numbers in the range of 0 to 100. After computing this exam score, we
compute a number between 0 and 100 based on the GPA. You will notice that the program
prompts for the GPA and the maximum GPA. Both the GPA and maximum GPA are real values
(i.e., they can have a decimal part). You should turn this into a score between 0 and 100 using
the following formula:
100
max_
actual_ gpa/max_gpa
At this point your program has two scores that vary from 0 to 100, one from their test score and
one from their GPA. The overall score for the applicant is computed as the sum of these two numbers (exam result + gpa result). Because each of these numbers is between 0 and 100, the
overall score for an applicant ranges from 0 to 200.
You do not have to perform any error checking. We will assume that the user enters numbers
and that they are in the appropriate range.
Explanation / Answer
I'm pretty sure the formulas in there aren't right, but I put them in as they are. In order to get something in the right range each of your ACT scores would have to be under 3 or so. You'll need to tweak them to make sure they work as intended. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Compare { /** * @param args * @throws IOException */ static int GPA = 0, GPAMAX = 1, ACTR = 2, ACTM = 3, ACTS = 4, SATV = 5, SATM = 6, ACTE = 7; public static void main(String[] args) throws IOException { double student1[] = getStudent("Student 1"); double student2[] = getStudent("Student 2"); int student1Index = indexStudent(student1); int student2Index = indexStudent(student2); System.out.println("Student 1: " + student1Index); System.out.println("Student 2: " + student2Index); } public static double[] getStudent(String name) throws IOException { InputStreamReader input2 = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(input2); double scores[] = new double[8]; System.out.print(name + " GPA: "); scores[GPA] = Double.parseDouble(br.readLine()); System.out.print("GPA Max: "); scores[GPAMAX] = Double.parseDouble(br.readLine()); System.out.print(name + " ACT Reading: "); scores[ACTR] = Double.parseDouble(br.readLine()); System.out.print(name + " ACT English: "); scores[ACTE] = Double.parseDouble(br.readLine()); System.out.print(name + " ACT Math: "); scores[ACTM] = Double.parseDouble(br.readLine()); System.out.print(name + " ACT Science: "); scores[ACTS] = Double.parseDouble(br.readLine()); System.out.print(name + " SAT Verbal: "); scores[SATV] = Double.parseDouble(br.readLine()); System.out.print(name + " SAT Math: "); scores[SATM] = Double.parseDouble(br.readLine()); return scores; } public static int indexStudent(double[] student) { int index = 0; double SAT = ((2 * student[SATV] * student[SATM])/24); double ACT = ((2 * student[ACTE] * student[ACTR] * student[ACTM] * student[ACTS])/1.8); if (SAT >= ACT) { ACT = 0; } else { SAT = 0; } double GPAScore = 100 * (student[GPA]/student[GPAMAX]); index = (int)(SAT + ACT + GPAScore); return index; } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.