programming 2
BMIS 208
Programming Assignment 2 Instructions
Adapted from Introduction to Programming Using Visual Basic 2012, 9/E, David I. Schneider.
Create a Visual Basic program that creates a bill for an automobile repair shop. The shop bills customers at the rate of $35 per hour for labor. Parts and supplies are subject to a 5% sales tax. The customer’s name, the number of hours of labor, and the cost of parts and supplies should be entered into the program via textboxes. When the Display Bill button is clicked, the customer’s name and the 3 costs should be displayed in a list box as shown below.
1. Name your application Assignment_2.
2. Name the form frmAssignment_2. The title should be as depicted below.
3. Name the labels lblCustomer, lblPhone, lblHours, and lblParts.
4. Name the textboxes txtCustomer, txtHours, and txtParts.
5. Name the listbox lstBill.
6. The Customer phone textbox should be a MaskedTextBox and should allow inputs only in the form of ___-____ (3 characters, followed by a dash, followed by 4 characters). Name this MaskedTextBox mtbPhone. Show the underlines and dash in the mask.
7. Add the access keys as displayed in the diagram below.
8. If the user leaves the Customer, Hours, or Parts textboxes blank, produce an error message (using a MessageBox) that informs the user to enter the appropriate information and do not display the information in the listbox.
9. Create variables to hold the customer, phone, hours, and parts information. Name the variables customer, phone, hours, and parts. Their data types should be string, string, double, and double, respectively.
10. When the user clicks the Display Bill button, prompt the user to enter in the date of the services. Store this information in a variable called service_date. Display this date and the date the invoice is due (30 days from the date entered) in the listbox as shown below. [Hint: use the AddDays function]. Store the due date in a variable called due_date.
11. Convert the customer name variable to upper case before displaying it in the listbox.
12. Whenever the user clicks the Display Bill button, the listbox should be cleared before displaying the new results.
13. To calculate the amounts, create three variables (labor_cost, parts_cost, and total_cost), and display these amounts in the listbox as shown below.
14. Be sure to use currency format where appropriate.
15. Be sure that the columns line up appropriately. [Hint: you can use the built-in Visual Basic constant “vbTab” to create neat columns in your listbox.]
Programming Assignment 3 Instructions
Adapted from Introduction to Programming Using Visual Basic 2012, 9/E, David I. Schneider.
Create a Visual Basic program to analyze a mortgage. The user should enter the amount of the loan, the annual percentage rate of interest, and the duration of the loan in months. When the user clicks on the button, the information that was entered should be checked to make sure it is reasonable. If bad data have been supplied, the user should be so advised. Otherwise, the monthly payment and the total amount of interest paid should be displayed. The formula for the monthly payment is:
Payment = p * r / (1 – (1 + r) ^ (-n)),
Where p is the amount of the loan, r is the monthly interest rate (annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the duration of the loan in months. The formula for the total interest paid is:
total interest = n * payment – p.
1. Design your screen to look like the one below.
2. Store the amounts entered by the user in variables and use these variables in the formula.
3. Use appropriate naming conventions for controls and variables.
4. Include internal documentation to describe the logic in your program (i.e. put comments in your code)
5. Make sure your error messages are meaningful.
6. Ensure that the user cannot enter anything into controls that display your totals.
Page 2 of 3