Exercise 4 - PowerPoint PPT Presentation

About This Presentation
Title:

Exercise 4

Description:

... complete amortization schedule consisting of the following 5 formatted and fixed ... Control then passes to the Display Amortization Schedule button (3) 7 ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 13
Provided by: Nashville51
Learn more at: https://ww2.nscc.edu
Category:

less

Transcript and Presenter's Notes

Title: Exercise 4


1
Exercise 4
  • Introduction to C
  • CIS-2320

2
  • Code the C windows application to implement the
    following form

3
  • Create a class called Loan which contains five
    private instance variables. These members will
    contain the principle (double) of the loan, the
    interest rate (double) of the loan, the length
    (integer) of the loan as a number of payments,
    the loans monthly payment (double), and the
    loans total interest (double).
  • The class will have one private method called
    Compute() which computes the monthly payment
    using the following equation payment (P R
    ((1 R)L)) / (((1 R)L) - 1)Where
    Pprinciple, Rinterest rate for 1 month,
    LLength of loan (as number of payments). The
    symbol represents raising to apower.
  • The class will have a parameterized constructor.
    This constructor will be passed the principle,
    interest rate, and length of loan when it is
    called.

4
  • The class will also provide accessors/getters
    for each of the private instance variables
    principle, interest rate, and length of loan,
    monthly payment, and total interest. You can
    create Properties for the above instead, if you
    want to.
  • The class will also provide mutators/setters
    for the private instance variables principle,
    interest rate, and length of loan. You can create
    Properties for the above instead, if you want to.
    Be sure to call the Compute() method to
    recalculate the monthly payment in each of these
    methods.
  • The class will also implement a method called
    Amortize( ) that creates an amortization schedule
    for the loan (see next slide).. Also, this
    class is to be IO independent.

5
  • Add a public method called Amortize( ) to build
    an array of strings containing the loans
    complete amortization schedule consisting of the
    following 5 formatted and fixed width columns
  • payment number ( 1 to number of payments )
  • beginning principle balance
  • amount of the payment applied to the interest
  • amount of the payment applied to the principle
  • new principle balance
  • Notes 1. The sum of 3 and 4 above MUST
    equal the loans monthly payment for
    every payment except the last one.
  • 2. Accumulate the total amount of interest
    for the loan.

6
  • The user will enter the loans principle amount,
    interest rate, and length of the loan in years
    (1). When the tab key is pressed the monthly
    payment is automatically calculated and control
    is given to the month so that the user can key in
    the month, day, and year of the first payment due
    date as shown below (2). Limit the date entered
    to the 1st thru the 28th of the month.
  • 1 2
    3

Control then passes to the Display Amortization
Schedule button (3)
7
  • When the user clicks the Display Amortization
    Schedule button, call the Amortize() method
    described above passing an Array object. When
    control returns, add the strings in the array to
    the list box (size the box so that it can display
    exactly the number of payments for one year) and
    add the due date for each payment.. Also display
    the total number of payments made, the total
    interest paid, and the total amount paid for the
    loan as shown below.

8
  • When the user clicks the Reset Form button, clear
    all text fields and the list box so that the
    form looks like

9
  • When the user starts to enter data in the Loan
    Principle box or the Interest Rate box or the
    Length of loan box immediately clear the list box
    and the total boxes.If the user changes the data
    in the Loan Principle box or the Interest Rate
    box or the Length of loan box, automatically
    recalculate the monthly payment if the other two
    boxes have data.

10
  • If the loan is for more than one year the list
    box should have a scroll bar so that all payments
    can be viewed by the user as shown in the slides
    below

11
  • Extra Points (4) Allow any date to be
    entered as the starting payment date and make
    sure that only valid due dates are
    displayed.

12
  • Extra points (4)
  • Implement the Calculate Total Interest
    button which calculates and displays the total
    interest for the loan without displaying the
    amortization schedule as shown below

Extra Extra points Add additional user frie
ndly features as you see fit to enhance the
program.
Write a Comment
User Comments (0)
About PowerShow.com