Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Visual Basic assignment: create a program to compute a loan payments, pay attention to each step: 1. Monthly payment 2. How much of is used
Visual Basic assignment:
create a program to compute a loan payments, pay attention to each step:
1. Monthly payment
2. How much of is used for interest after each monthly payment
3. How much of is used for principal after each monthly payment
4. The balance of the loan after each monthly payment
5. Display the month number and all of the above items as a line in a list box for each month.
All computations are done on monthly basis.
Input data:
- Loan: The amount of the loan;
- Period: Number of years the loan to be paid back. It is entered in years, you need to multiply by 12 to get number of months;
- Annual Interest Rate: Entered in percentage, you need to divide it by 12 for monthly interest, and then divide by 100 to use in computations. VB does not use percentage.
- Use labels to identify loan components (three TextBoxes) and results (ListBox). ListBox displays the Month, Monthly Payment, Principal, Interest and Loan Balance for each month. Buttons are to Calculate, Clear Input and Exit program. See below Form Layout with Controls for more details. Note: The control Names are shown in callouts.
- You will declare two set of variables:
-
- Input variables:
- Loan Amount (Double)
- Period (Integer)
- Interest (Double)
-
- Output variables:
- Count (Integer, to be used for For Loop to keep track of Loan period)
- Months (Integer, to calculate Loan number of months
- Payment (Double, for monthly payment)
- ToInterest (Double, how much of the monthly payment to Interest)
- ToPrincipal (Double, how much of the monthly payment to Principal)
- Balance (Double, displays loan's balance on monthly basis)
- Output (String, to display Month, Monthly payment, ToPrincipal, ToInterest and Balance in the ListBox.
- To convert Interest Rate to monthly interest rate, do the following: 1. divide by 100; 2. divide by 12.
- To calculate Number of Years into months, do the following: multiply by 12.
- To calculate Monthly payment, use PMT function: PMT(interest rate, months, -loan amount). Pay attention to minus symbol in front of loan amount.
- Create a For ... Next loop to calculate the values you need for ListBox.
- For loop starts with: For Counter = 1 to months
- To calculate ToInterest, do the following: Balance * Interest
- To calculate ToPrincipal, do the following: Payment - ToInterest
- To calculate Balance, do the following: Balance - ToPrincipal
- Build the string for displaying Output in ListBox. See my comments in Discussion.
- Items to note:
- Label control that displays: Month, Payment, ToInterest, ToPrincipal and Loan is one control. Use spaces to type in its Text property.
- variables names must follow the conventions and rules explained earlier and must have proper data type for the values that will be stored in them.
- Text property of controls must use the text shown in the image below.
- Clear Input button, clears TextBoxes and ListBox.
- Exit button, closes the Form.
- You will write the code for the three buttons.
- Avoid double-clicking on TextBox and Label Controls to create unnecessary code. If you do delete them.
- Run the program, enter values for Loan, Period and Interest rate, then click Calculate button, to see the Monthly information display in the ListBox.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started