46 lines
1.0 KiB
Java
Raw Normal View History

2021-02-03 16:04:53 -05:00
import java.util.Scanner;
2021-02-03 14:34:48 -05:00
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;
}
2021-02-03 16:04:53 -05:00
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);
}
}
2021-02-03 14:34:48 -05:00
}