A sales rep travels from client to client on a daily basis selling widgets. Sales reps may claim their travel costs and have their KMs reimbursed by the company. The company pays .55 cents per KM. If the KMs travelled for a particular day is more than 300 KM, a flat daily rate of $150 is paid. The sales rep needs a program to keep track of mileage and calculate the information to be reimbursed and reported to the company.
The program should provide the following functionality:
1. A Button to initialize the forms fields for data input.
2. A textbox should be used to add daily KM travelled to a list box, each entry in the listbox represents a day’s KMs travelled.
3. Calculate the total amount of KMs travelled.
4. Calculate total Amount of KMs traveled for Flat Rate Days.
5. Calculate the total number of days travelled (each entry in the listbox is considered a travel day)
6. Calculate Total Number of Days travelled that are flat rate KMs
7. Calculate the total reimbursement amount based on the above reimbursement rules and KMs Travelled.
8. Calculate the total flat rate reimbursement amounts based on flat rate rules.
9. User inputs should be validated, and friendly error messages is displayed to the user.
Input Data should be validated to prevent invalid data from being entered into the listbox. Specific error messages should be displayed for each of the invalid inputs.
A global array should be created to store the programs messages. When displaying messages to the user, retrieve the corresponding message from the array. A sub procedure should be created to display these messages to the user from the array. It should take a message code as a parameter which should be used to get the relevant message from the array for display.
A sub procedure should be created and called to initialize the form’s data. The form should be initialized when the form loads as well as when the corresponding button is clicked.
There are 6 pieces of information that need to be calculated from the contents of the listbox based on the above. Functions should be used to calculate each of these pieces of data from the listbox and the value returned to the caller to be placed in the corresponding label for display. Note, the listbox control should be passed in as a parameter to the functions for tabulation.
You have flexibility in the implementation of the functions. Individual functions can be used for each piece of information to be calculated (Total KMs, Flat Rate KMs, Total Days. Flat Rate Days. Total Reimbursement Dollar Amount, Flat Rate Reimbursement Dollar Amount). Or you may use a parameter passed to the functions to instruct them which values it must calculate.