public class Application { // instance variables: private double gpa, athleticAbility, parentalDonation, income; private boolean resident, criminalRecord, admit, scholarship, loan; // getters (for R and R/W variables): public double getGpa() { return this.gpa; } public double getAthleticAbility() { return this.athleticAbility; } public double getParentalDonation() { return this.parentalDonation; } public double getIncome() { return this.income; } public boolean isResident() { return this.resident; } public boolean hasCriminalRecord() { return this.criminalRecord; } public boolean getAdmit() { return this.admit; } public boolean getScholarship() { return this.scholarship; } public boolean getLoan() { return this.loan; } // setters (for R/W variables): public void setGpa(double newVal) { this.gpa = newVal; } public void setAthleticAbility(double newVal) { this.athleticAbility = newVal; } public void setParentalDonation(double newVal) { this.parentalDonation = newVal; } public void setIncome(double newVal) { this.income = newVal; } public void setResident(boolean newVal) { this.resident = newVal; } public void setCriminalRecord(boolean newVal) { this.criminalRecord = newVal; } /** Determines if an applicant should be admitted */ public void setAdmit() { this.admit = !this.criminalRecord && this.gpa >= 3.0 || this.gpa >= 2.0 && resident || this.parentalDonation >= 50000 || this.athleticAbility > 3; } /** Determines if an applicant should be awarded a scholarship */ public void setScholarship() { this.scholarship = this.admit && this.income < 20000 && this.gpa >= 3.0 && this.resident; } /** Determines if an applicant should be offerred a loan */ public void setLoan() { this.loan = this.admit && this.income < 30000 && this.gpa >= 2.0 && this.resident; } public void computeStatus() { setAdmit(); setScholarship(); setLoan(); } public void displayResults() { System.out.println("admit? = " + this.admit); System.out.println( "offer scholarship? = " + this.scholarship); System.out.println("offer loan? = " + this.loan); } public static void main(String[] args) { Application app1 = new Application(); app1.setGpa(3.1); app1.setAthleticAbility(1.2); app1.setParentalDonation(5000); app1.setIncome(23000); app1.setResident(true); app1.setCriminalRecord(false); app1.computeStatus(); app1.displayResults(); Application app2 = new Application(); app2.setGpa(2.8); app2.setAthleticAbility(2.1); app2.setParentalDonation(0); app2.setIncome(15000); app2.setResident(true); app2.setCriminalRecord(false); app2.computeStatus(); app2.displayResults(); } }