1 / 12

Exercise 4

Exercise 4. Introduction to C# CIS-2320. Code the C# windows application to implement the following form:.

rwagner
Download Presentation

Exercise 4

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 containsfive 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 loan’s monthly payment (double), and the loan’s 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)WhereP=principle, R=interest rate for 1 month, L=Length 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 loan’s 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 loan’s 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 loan’s 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 friendly”features as you see fit to enhance the program.

More Related