2021-02-10 09:40:19 -05:00

46 lines
1.0 KiB
Java

import java.util.Scanner;
import java.util.ArrayList;
public class CreditUnion{
ArrayList<HomeBuyer> homeBuyers = new ArrayList<HomeBuyer>();
public ArrayList<HomeBuyer> getPreApprovedList(){
ArrayList<HomeBuyer> approvedHomeBuyerList = new ArrayList<HomeBuyer>();
for (HomeBuyer buyer:homeBuyers){
if (buyer.getCreditScore()>=700){
approvedHomeBuyerList.add(buyer);
}
}
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);
}
}
}