fixed Makefile, updated driver

git-svn-id: svn://anubis/gvsu@73 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2008-03-20 04:45:41 +00:00
parent 44793226d8
commit a28700667a
2 changed files with 19 additions and 1 deletions

View File

@ -8,6 +8,8 @@ public class LoanApplication
public void run() public void run()
{ {
PrintSpooler spooler = PrintSpooler.getSpooler();
try try
{ {
for (;;) for (;;)
@ -26,6 +28,22 @@ public class LoanApplication
System.out.print("Enter the principal balance: "); System.out.print("Enter the principal balance: ");
double principal = Double.parseDouble(br.readLine()); double principal = Double.parseDouble(br.readLine());
int type = 0;
while (type < 1 || type > 2)
{
System.out.println("Please select whether the loan is a simple interest loan or an amortized loan:");
System.out.println("Select:");
System.out.println(" 1) simple interest loan");
System.out.println(" 2) amortized loan");
type = Integer.parseInt(br.readLine());
}
Loan loan = (type == 1)
? new SimpleLoan(name, rate, years, principal)
: new AmortizedLoan(name, rate, years, principal);
spooler.printDocument(loan.process());
} }
} }
catch (Exception e) { } catch (Exception e) { }

View File

@ -1,5 +1,5 @@
all: *.class all: $(patsubst %.java,%.class,$(wildcard *.java))
%.class: %.java %.class: %.java
javac $^ javac $^