Here is a C# Application I developed for calculating the monthly payment for a loan, given the loan amount, interest rate and the loan period.
I have used four labels, four text boxes and two buttons on a simple Windows form as shown below. In addition, a status bar along the bottom of the form is used to describe what is expected in each text field. The Calculate button computes the monthly payment and displays the result in the fourth text box. Clicking the Exit button quits the application. Tool tips are also displayed when the mouse hovers over each text box. A timer control is used to display the right message in the status bar.
The text boxes prevent non-numeric entry, by filtering out characters other than 0-9 and the decimal point. The user is not allowed to edit the fourth text box (Payment). See the event handler under the textBox1.KeyPress for details of how non-numeric keys are handled. The KeyPressEventHandler takes care of this. The calculation for monthly payments is performed by the static method calcPayment that is invoked by the click event of the Calculate button. The use of both the status bar and tooltips may appear to be an overkill. However, I left them both in simply to illustrate the use of the tooltips and the status bar messages for helping the user with data input. Comments are welcome.
//C# Code for the Financial Loan Calculation Application
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: