Be sure to add appropriate comments in your code. Each variable used in your program needs a comment describing its purpose. These requirements are expected for every program and are listed in the syllabus. Preconditions and postconditions are not expected yet, as we’ve not covered them in class. However, comments are expected for important sections of code, including event handlers.
We are creating an interest calculator for a variety of Loan types. Customers may request a loan that is one of three types and will be given a rate based on their credit score and Loan term. Valid credit scores will range from 300-850.
Based on what type of rate is selected by the user, their loan interest will be modified accordingly. Home loans are loans given by banks or a mortgage company to purchase a home. Auto loans are loans used to purchase a car. An unsecured loan is a loan that does not require collateral. Collateral is money or an object of value used as the default payment if the loan cannot be paid back.
We will also ask for how large the loan will be, for the purposes of a down payment. The company does not originate loans larger than $500,000. The amount must be greater than zero.
Make sure you use TryParse to validate if a loan type was chosen, if the entered credit score is valid, and if the entered loan amount is valid. If any of the criteria is not met, have a message box display, prompting the user to enter valid inputs.
Use for loops to look for the credit score, loan type, and loan amount values in the arrays.
Here are some hints for you:
Using a combo box will allow us to know the user has selected a valid loan type or loan duration, if some value in the box is selected (refer to the examples below). Combo boxes can be found in the common controls section. To check for a selection, we check that the .SelectedIndex property is 0 or above (like arrays, index here starts at zero). We can retrieve the user’s selected text through the .Text Property. The Items property controls what is in the box and is most easily set from the form designer (since it will be static for this program).
You are allowed to use magic numbers within your arrays to avoid an overload of constants. All other magic numbers require constants.
If written with ifs, this program would require at least 13 if statements. Therefore, loops and arrays are required.