Visual Basic Assignment
First I want you to do the problems in the algorithm assignment so you can see how they work in another language.
You can use the InputBox command to take in user input or you can set up text boxes on the form to take in user input,
Most of these would work better with text boxes so you can see the information.
Problem #1: Take in the high temperature for a day and the low temperature for a day. Display the average
temperature for the day.
Problem #2: You need to take in the price of four items a customer bought, determine the total price before tax,
determine the tax using the tax rate of 2.5% and then determine the total price after taxes. The output should
show the total price before tax, the tax and the total price after taxes.
Problem #3: You have received 5 numeric grades for the semester. Grades can range from 0 to 100. The first grade
counts for 10% of you final grade. The second grade counts for 15% of your final grade. The third grade counts for
25% of your final grade. The fourth grade counts for 20% of your final grade. The fifth grade counts for 30% of
your final grade. Calculate and display your final numeric grade.
Problem #4: You need to calculate an employees pay. To do this you will need:
- the number of hours the employee worked
- the number of hours the employee is contracted to work before the employee receives overtime
(for example, the employee might be contracted to work 40 hours and only receives overtime for hours over 40)
- the pay per hour
- the rule for calculating over time (time and one half would be 1.5 while double time would be 2).
Test this problem with information about an employee who did not work over their contracted hours and again for
an employee who did work over their contracted hours.
Problem #5: Set up the following array for places you want to visit. You should have a textbox to take in the
trip number and a textbox to hold the destination that is returned. Invalid entries should display a message.
| Trip Number | Destination |
| 1 | London |
| 2 | Edinburgh |
| 3 | Tokyo |
| 4 | Pretoria |
| 5 | Buenos Aires |
| 6 | Baku |
| 7 | Lisbon |
| 8 | Sydney |
Problem #6: Write a program that contains a loop that you will do 5 times. Inside the loop, you want to use an
InputBox to take in an amount and add it to a total. When the loop is done, you want to print out the total in
a text box on the form. The loop should be started by clicking a command button.
ans = InputBox("Enter a number",0)
This can be used to take in an a user input, it is like the prompt in JavaScript.
Remember, you need to send me the .vbp and the .frm. You can attach them both or you can zip
them up and send them.