Homework 2: Object Oriented Programming, Windows Controls, and Exception Handling

profileThehonest
 (Not rated)
 (Not rated)
Chat

BIT 3444

Homework 2: Object Oriented Programming, Windows Controls, and Exception Handling

 

This is an individual homework assignment. Use VB.NET to develop a loan calculator

as a Windows Form application.

 

1. User interface Design (30 points): 

(1) (20 pts) The basic user interface requires the following Windows Form controls:

TextBox: Let the user specify a loan amount (p),

TextBox: Let the user specify an annual interest rate (r) as a percentage,

TextBox: Let the user specify the number of years for the calculation period (n),

ListBox: Is used to display the monthly payment (A) and remaining balance (B) after payment for each month over n years 

CheckBox: Is used to Indicate if the loan is a simple interest loan or a compound interest loan

Button: Calculates the monthly payment and remaining balance after each

payment for each month over n years and display the result in the ListBox, Button: Clear all user inputs on the user interface.

Label controls should be used whenever they are needed. 

 

The properties of the above controls should be specified as follows.

Control Property Value

 

 

 (2) (10 pts) MenuStrip and ToolStrip: Add a MenuStrip and a ToolStrip control

(shown below) to the user interface. You need to specify the accelerator, shortcut

keys, and incons as indicated in the screenshots below. You can get the icon files

from the SilkIcon Library (the icon file to be used are new.png, calculator.png,

and door_out.png).

 

 

OOP Programming (70 points): 

(1) (20 pts) Define the Loan class. This class assumes that the amount of loan rises

because the interest is added to the principle amount at the end of each time

period. This class has two properties: loan amount (p), annual interest rate r  (0 <r <

1), and loan length in years (n>=0). A constructor is needed for instantiation and

initialization. The class has a function that calculates the monthly payment:

 

 

A =

(r / 12) * p

1- (1+ r / 12)

-(n*12)

 

The class has another function that takes the number of months (N) as the input and

returns the ending balance (B) at the end of month N: 

 

(2)  (10 pts) Define the SimpleInterestLoan class, which is a sub class of the Loan class.

This class assumes that the interest will not be added to the principle amount. This

class has two overridden functions for calculating the monthly payment (A) and

ending balance (B) at the end of month N, respectively:

 

(3) (10 pts) When the user enters a non-numeric value in any of the three TextBox

controls, your program is going to throw an exception when the value is converted

into a number. Use a Try…Catch statement to handle the exception without

interrupting the program execution.

 

(4)  (10 pts) Use the data validation technique to check if the annual interest rate

percentage specified by the user is greater than or equal to 0 and less than or equal

to 1. 

 

(5) (10 pts) When the user clicks CalculateButton, your program should use the

function defined either in Loan or SimpleInterestLoan class depending upon the

status of LoanTypeCheckBox. Apply polymorphism to this programming task.

Display the amortization result showing the monthly payment and the end of

balance for every month over the period of n years. The amortization result should

be displayed in the ListBox in the following format (use vbTab as the separator

between values): 

 

 

(6) (5 pts)The ClearButton does the following after it is clicked: 

• Clear the contents of all the TextBox controls

• Clear the items in DisplayListBox

 

(7) (5 pts) You also need to make sure that, when the user clicks a ToolStripMenuItem or a ToolStripButton, the corresponding function be executed. Use one event handler to respond to multiple events that are related.

When the user clicks the “About” ToolStripMenuItem, display the name of your application along with any information that you think necessary (version number, author, year, etc.)

 

Instructions for Homework Submission: Compress your entire VB project folder into a

.zip file using Windows. To compress your VB project in Windows, you need to browse

to the folder level where you can see your top project folder (one level above the folder

where the .sln file is stored). Next, right click on the project folder and select “Send to”

à “Compressed(zipped) Folder”. You will see a file created with the extension “.zip”.

Upload the zip file to our Scholar site.

 

 

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      interest_calculator.zip