Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to figure out how to save or remember the scores for the first appli

ID: 3758292 • Letter: I

Question

I'm trying to figure out how to save or remember the scores for the first applicant and the second applicant so that I can compare them in the last method and determine which one is the better applicant but I can't think of how to do that. I have most of the code figured out.

import java.util.*;

public class Admissions {

public static void main(String[] args) {
Scanner console = new Scanner(System.in);
intro();
applicantPrompt(console);
gpa(console);
applicantTwo();
applicantPrompt(console);
gpa(console);
}

public static void intro() {
System.out.println("This program compares two applicants to determine which one seems like the stronger applicant. For each candidate I will need either SAT or ACT scores plus a weighted GPA. ");
System.out.println("Information for applicant #1:");
}

//Asks user whether they have SAT scores or ACT scores. Based on their answer it leads them to the next string of questions.
public static void applicantPrompt(Scanner console) {
System.out.print("do you have 1) SAT scores or 2) ACT scores? ");
int response = console.nextInt();   
if (response == 1 ) {
satScore(console);   
} else {
actScore(console);
}
}

//
public static void satScore(Scanner console) {
System.out.print("SAT math? ");
int satMathScore = console.nextInt();
System.out.print("SAT critical reading? ");
int satReadingScore = console.nextInt();
System.out.print("SAT writing? ");
int satWritingScore = console.nextInt();
double satTotal = (2 * satMathScore + satReadingScore + satWritingScore)/32;
System.out.println("exam score = " + satTotal);
}

//
public static void actScore(Scanner console) {
System.out.print("ACT English? ");
int actEnglishScore = console.nextInt();
System.out.print("ACT math? ");
int actMathScore = console.nextInt();
System.out.print("ACT science? ");
int actScienceScore = console.nextInt();
double actTotal = (2 * actEnglishScore + actMathScore + actScienceScore)/1.8;
System.out.println("exam score = " + actTotal);
}

//
public static void gpa(Scanner console) {
System.out.print("overall GPA? ");
double overallGPA = console.nextDouble();
System.out.print("max GPA? ");
double maxGPA = console.nextDouble();
System.out.print("Transcript Multiplier ");
double transcriptMultiplier = console.nextDouble();
double gpaScore = (overallGPA/maxGPA) * 100 * transcriptMultiplier;
System.out.println("GPA score = " + gpaScore);
}

public static void applicantTwo() {
System.out.println("Information for applicant #2:");
}
public static void report() {
System.out.println("First applicant overall score = ");
System.out.println("Second applicant overall score = ");
}
}

Explanation / Answer

import java.util.Scanner;

public class Admissions {

   public static void main(String[] args) {
       double gpaScores[]=new double[2];
       Scanner console = new Scanner(System.in);
      
       intro();
      
       applicantPrompt(console);
       gpaScores[0]=gpa(console);
       applicantTwo();
       applicantPrompt(console);
       gpaScores[1]=gpa(console);
       report(gpaScores);
      
   }

   public static void intro() {
       System.out
               .println("This program compares two applicants to determine which one seems like"
                       + "the stronger applicant. For each candidate I will need either SAT or ACT scores plus a "
                       + "weighted GPA. ");
       System.out.println("Information for applicant #1:");
   }

   // Asks user whether they have SAT scores or ACT scores. Based on their
   // answer it leads them
   // to the next string of questions.
   public static void applicantPrompt(Scanner console) {
       System.out.print("do you have 1) SAT scores or 2) ACT scores? ");
       int response = console.nextInt();
       if (response == 1) {
           satScore(console);
       } else {
           actScore(console);
       }
   }

   //
   public static void satScore(Scanner console) {
       System.out.print("SAT math? ");
       int satMathScore = console.nextInt();
       System.out.print("SAT critical reading? ");
       int satReadingScore = console.nextInt();
       System.out.print("SAT writing? ");
       int satWritingScore = console.nextInt();
       double satTotal = (2 * satMathScore + satReadingScore + satWritingScore) / 32;
       System.out.println("exam score = " + satTotal);
   }

   //
   public static void actScore(Scanner console) {
       System.out.print("ACT English? ");
       int actEnglishScore = console.nextInt();
       System.out.print("ACT math? ");
       int actMathScore = console.nextInt();
       System.out.print("ACT science? ");
       int actScienceScore = console.nextInt();
       double actTotal = (2 * actEnglishScore + actMathScore + actScienceScore) / 1.8;
       System.out.println("exam score = " + actTotal);
   }

   //
   public static double gpa(Scanner console) {
       System.out.print("overall GPA? ");
       double overallGPA = console.nextDouble();
       System.out.print("max GPA? ");
       double maxGPA = console.nextDouble();
       System.out.print("Transcript Multiplier ");
       double transcriptMultiplier = console.nextDouble();
       double gpaScore = (overallGPA / maxGPA) * 100 * transcriptMultiplier;
       System.out.println("GPA score = " + gpaScore);
       return gpaScore;
   }

   public static void applicantTwo() {
       System.out.println("Information for applicant #2:");
   }

   public static void report(double gpaScores[]) {
       System.out.println("First applicant overall score = "+gpaScores[0]);
       System.out.println("Second applicant overall score = "+gpaScores[1]);
       if(gpaScores[0]>gpaScores[1]){
           System.out.println("First applicant is better ");
       }else{
           System.out.println("Second applicant is better ");
       }
   }
}

output :

This program compares two applicants to
determine which one seems likethe stronger
applicant. For each candidate I will need
either SAT or ACT scores plus a weighted GPA.

Information for applicant #1:
do you have 1) SAT scores or 2) ACT scores? 1
SAT math? 34
SAT critical reading? 33
SAT writing? 54
exam score = 4.0
overall GPA? 54
max GPA? 78
Transcript Multiplier 66
GPA score = 4569.230769230769
Information for applicant #2:
do you have 1) SAT scores or 2) ACT scores? 2
ACT English? 76
ACT math? 87
ACT science? 65
exam score = 168.88888888888889
overall GPA? 56
max GPA? 76
Transcript Multiplier 66
GPA score = 4863.157894736842
First applicant overall score = 4569.230769230769
Second applicant overall score = 4863.157894736842
Second applicant is better