Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class Application
- {
- public static void main(String[] args) throws IOException
- {
- //John's Info
- LoanAccount j_LoanAccount = new LoanAccount(20000);
- CurrentAccount j_CurrentAccount = new CurrentAccount();
- int jIncome = 2000;
- int jExpenses = 1200;
- int jLoanPayment = 200;
- int jRemaining = (jIncome - jExpenses - jLoanPayment);
- float jLoanBalance = j_LoanAccount.getBalance();
- for (int i=0; jLoanBalance > 0; i++) {
- j_LoanAccount.makePayment(jLoanPayment);
- j_CurrentAccount.makeDeposit(jRemaining);
- j_LoanAccount.addInterest();
- j_CurrentAccount.addInterest();
- }
- System.out.print("John repaid his loan after " + i + " months.");
- System.out.println(" His current account balance at that time was £" + j_CurrentAccount.getBalance() + ".");
- //Mary's Info
- LoanAccount m_LoanAccount = new LoanAccount(20000);
- SavingsAccount m_SavingsAccount = new SavingsAccount(100);
- int mIncome = 2000;
- int mExpenses = 1200;
- int mLoanPayment = 200;
- int mRemaining = (mIncome - mExpenses - mLoanPayment);
- float mLoanBalance = m_LoanAccount.getbalance();
- for (int i=0; mLoanBalance > 0; i++) {
- m_LoanAccount.makePayment(jLoanPayment);
- m_SavingsAccount.makeDeposit(jRemaining);
- m_LoanAccount.addInterest();
- m_SavingsAccount.addInterest();
- }
- System.out.print("Mary repaid her loan after " + i + " months.");
- System.out.println(" Her savings account balance at that time was £" + m_SavingsAccount.getBalance() + ".");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement