Advertisement
Guest User

Controller Class

a guest
Mar 5th, 2012
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. public class Controller {
  2.  
  3. public static Annuity thisAnnuity;
  4. public static PresentValue thisPresentValue;
  5. public static ArrayList<PresentValue> pPresentValue;
  6. public static void main(String[] args)
  7. {
  8.  
  9. Annuity thisAnnnuity = new Annuity();
  10. thisAnnnuity.setPayment();
  11. thisAnnnuity.setTerm();
  12. thisAnnnuity.setRate();
  13. thisAnnnuity.setType();
  14.  
  15. ArrayList<Annuity> pAnnuity = new ArrayList<Annuity>();
  16.  
  17. int counter = 0;
  18.  
  19. if(Annuity.getType = "0")
  20.  
  21. while(counter != thisAnnuity.getTerm())
  22. {
  23. counter++;
  24. thisAnnuity = new Annuity(counter, thisAnnuity.getPayment(), thisAnnuity.getRate(), thisAnnuity.getPVOFactor);
  25. pPresentValue.add(thisPresentValue);
  26. thisAnnuity.set(thisPresentValue.getPresentValue());
  27.  
  28. }
  29.  
  30. if(Annuity.getType = "1")
  31. while(counter != thisAnnuity.getTerm())
  32. {
  33. counter++;
  34. thisAnnuity = new Annuity(counter, thisAnnuity.getPayment(), thisAnnuity.getRate(), thisAnnuity.getPVOFactor);
  35. pPresentValue.add(thisPresentValue);
  36. thisAnnuity.set(thisPresentValue.getPresentValue());
  37.  
  38. }
  39.  
  40. else
  41. {
  42. System.err.println("Invalid Annuity Type: Please enter either 0 or 1");
  43. }
  44.  
  45. System.out.println("Annuity [Payment= " + pPayment + ", Term= " + pTerm + ", Rate= " + rate + ", Type= " + pType + "]");
  46. System.out.println("Present Value = $" + pPresentValue);
  47. System.out.println("PV Factor = " + pPVOFactor);
  48.  
  49.  
  50.  
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement