Finish Mortgage
This commit is contained in:
parent
b1ea675cb9
commit
17aaff6ebb
@ -1,7 +1,7 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class CreditUnion{
|
public class CreditUnion{
|
||||||
//ArrayList of HomeBuyer objects as borrower roster
|
|
||||||
ArrayList<HomeBuyer> homeBuyers = new ArrayList<HomeBuyer>();
|
ArrayList<HomeBuyer> homeBuyers = new ArrayList<HomeBuyer>();
|
||||||
|
|
||||||
public ArrayList<HomeBuyer> getPreApprovedList(){
|
public ArrayList<HomeBuyer> getPreApprovedList(){
|
||||||
@ -16,4 +16,30 @@ public class CreditUnion{
|
|||||||
return approvedHomeBuyerList;
|
return approvedHomeBuyerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addHomeBuyer(HomeBuyer buyer){
|
||||||
|
homeBuyers.add(buyer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void inputBuyer(Scanner scnr){
|
||||||
|
HomeBuyer currBuyer;
|
||||||
|
int quitFlag = 0;
|
||||||
|
|
||||||
|
String fName;
|
||||||
|
String lName;
|
||||||
|
int creditRating;
|
||||||
|
|
||||||
|
while (true){
|
||||||
|
System.out.print("Type a negative #; positive to continue: ");
|
||||||
|
quitFlag = scnr.nextInt();
|
||||||
|
if (quitFlag < 0){break;}
|
||||||
|
|
||||||
|
System.out.print("Type first name last name credit rating: ");
|
||||||
|
fName = scnr.next();
|
||||||
|
lName = scnr.next();
|
||||||
|
creditRating = scnr.nextInt();
|
||||||
|
|
||||||
|
currBuyer = new HomeBuyer(fName, lName, creditRating);
|
||||||
|
addHomeBuyer(currBuyer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,8 @@ public class HomeBuyer{
|
|||||||
public int getCreditScore(){
|
public int getCreditScore(){
|
||||||
return creditScore;
|
return creditScore;
|
||||||
}
|
}
|
||||||
|
public String toString(){
|
||||||
|
return fName + " " + lName + " (Credit Score: " + creditScore + ")";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
public class LabProgram{
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Scanner scnr = new Scanner(System.in);
|
||||||
|
|
||||||
|
CreditUnion cu = new CreditUnion();
|
||||||
|
|
||||||
|
String fName;
|
||||||
|
String lName;
|
||||||
|
int creditRating;
|
||||||
|
|
||||||
|
ArrayList<HomeBuyer> preApprovedBuyers;
|
||||||
|
|
||||||
|
cu.inputBuyer(scnr);
|
||||||
|
|
||||||
|
System.out.println("Mortgage Pre-Approved's list:");
|
||||||
|
|
||||||
|
preApprovedBuyers = cu.getPreApprovedList();
|
||||||
|
|
||||||
|
for (HomeBuyer buyer:preApprovedBuyers){
|
||||||
|
System.out.println(buyer.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user