Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. import java.io.*;
  2. public class Application
  3. {
  4. public static void main(String[] args) throws IOException
  5. {
  6. //John's Info
  7. LoanAccount j_LoanAccount = new LoanAccount(20000);
  8. CurrentAccount j_CurrentAccount = new CurrentAccount();
  9.  
  10.  
  11. int jIncome = 2000;
  12. int jExpenses = 1200;
  13. int jLoanPayment = 200;
  14. int jRemaining = (jIncome - jExpenses - jLoanPayment);
  15. float jLoanBalance = j_LoanAccount.getBalance();
  16.  
  17. for (int i=0; jLoanBalance > 0; i++) {
  18. j_LoanAccount.makePayment(jLoanPayment);
  19. j_CurrentAccount.makeDeposit(jRemaining);
  20. j_LoanAccount.addInterest();
  21. j_CurrentAccount.addInterest();
  22.  
  23. }
  24.  
  25. System.out.print("John repaid his loan after " + i + " months.");
  26. System.out.println(" His current account balance at that time was £" + j_CurrentAccount.getBalance() + ".");
  27.  
  28.  
  29. //Mary's Info
  30. LoanAccount m_LoanAccount = new LoanAccount(20000);
  31. SavingsAccount m_SavingsAccount = new SavingsAccount(100);
  32.  
  33. int mIncome = 2000;
  34. int mExpenses = 1200;
  35. int mLoanPayment = 200;
  36. int mRemaining = (mIncome - mExpenses - mLoanPayment);
  37. float mLoanBalance = m_LoanAccount.getbalance();
  38.  
  39. for (int i=0; mLoanBalance > 0; i++) {
  40. m_LoanAccount.makePayment(jLoanPayment);
  41. m_SavingsAccount.makeDeposit(jRemaining);
  42. m_LoanAccount.addInterest();
  43. m_SavingsAccount.addInterest();
  44.  
  45. }
  46.  
  47. System.out.print("Mary repaid her loan after " + i + " months.");
  48. System.out.println(" Her savings account balance at that time was £" + m_SavingsAccount.getBalance() + ".");
  49.  
  50.  
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement