Visual Basic Performance Based Test

Select 2 projects from the choices below and complete the task in Visual Basic. Save the file with the file name: FinalProject(Question#). For Example: FinalProject3 if I select number 3 below

Save all your work to your Visual Basic folder, into a folder called FINAL.

 

1.  Scenario: Flowers Forever wants an application that the clerks can use to calculate each salesperson’s annual bonus. The clerk will need to enter the sales. The application should calculate the bonus based on the amount of sales, as follows:

Amount of sales

Bonus

0-3000.9

$ 0

3001-5000.99

50

5001-9999.99

100

10000 and over

250

 

a)      Create an appropriate user interface.

b)      Be sure to include a Print button, which will print the interface without any command buttons showing, and an Exit button, Also be sure to center the form on the screen. 

c)       Save the form and the project as above.

d)      Code the application using the Select Case statement. Use the MsgBox function to display an appropriate message if the user enter a negative sales amount

e)      Save and run the application

f)       To test the application, enter t-90 as the sales t, then calculate the bonus. Remove the MsgBox function’s dialog box.

g)      Test the application again by entering 3001 as the sales. Calculate the bonus, and then print the interface.

h)      Test the application again by entering 9000 as the sales. Calculate the bonus, then print the interface.

i)        Test the application again by entering 20500 as the sales. Calculate the bonus, then print the interface.

j)        Click the Exit button to end the application, then print the application’s code.

k)      Submit the printouts from steps f, g, and h. Also submit the code from step j.

 

2. Use the For Next loop to print the first 10 Fibonacci numbers.

a)      Create a user interface that contains two command buttons. Name one of the command buttons cmdDisplay and change its Caption to display Fibonacci numbers. Name the other command button cmdExit and change its caption to Exit

b)      Save the form and the project above.

c)       Open the cmdDisplay control’s Code window. In the click event , enter a For Next statement that will print the first 10 Fibonacci numbers(1,1,2,3,5,8,13,21,34,55) on the form. (Hint: Notice that, beginning with the third number in the series, each number is the sum of the prior two numbers, in other words, 2 is the sum of 1 plus 1, 3 is the sum of 1 plus 2, 5 is the sum of 2 plus 3 and so on. )

d)      Code the cmdExit control’s Click event procedure so that it will end the application.

e)      Save and run the application. Click the Display Fibonacci Numbers button, and then click the Exit button.

f)       Print the code.

3. Use the repetition structure.

Scenario: Premium paper wants an application that will allow it to enter the company’s income and expense amounts. The number of income and expense amounts may vary each time the application is run. (For example, the user may enter five income amounts and three expense amounts, or 20 income amounts and 30 expense amounts.)  The application will calculate and display the total income, the total expense, and the company’s profit (or loss). (Hint: Use the Input box function to get the income and expense amounts. Recall that you learned about the input box function in Tutorial 3)

a.        Create an appropriate interface. Include a Print button that will print the interface with the command buttons showing. Be sure to read the Note at the beginning of the Exercises section.

b.      Save the form and the project.

c.       Code the application appropriately.

d.      Save and run the project. Test the project twice. Using the below data. Be sure to print the interface after calculating the profit (loss).

First test:             Income amounts: 5000, 6000, 35000, 78000

                                Expense amounts: 1000, 2000, 600

Second test:       Income amounts: 8000, 2000

                                 Expense amounts: 12000

e.      When the program is working correctly, print the code. Submit the printouts from step d and the code from step e.

4. Use a list box.

Scenario: Mary Kaye wants an application that will allow her to calculate, display, and print the area of a rectangle, a circle, or a triangle. (Use 3.14 as the value of pi.)

a.       Create an appropriate interface. Display the Circle, Rectangle, and Triangle choices in a list box.

b.      Save the form and the project.

c.       Code the application appropriately.

d.      Save and run the application. Test the application by displaying the area of a rectangle that has a length of 9 inches and a width of 8 inches. Then display the area of a circle that has a radius of 10 inches. Lastly, display the area of a triangle that has a base of 15 inches and a height of 5 inches.

e.       Stop the application, and then print the code. Indicate the answers to step d on the printout.

5. Manipulate strings.

Scenario: Each employee at Acme Wares is assigned an employee number, which consists of three characters. If the employee is salaried, the second digit in the employee number is always a 1. For example, employee number 117 would indicate a salaried employee. If the employee is hourly, the second digit is a 2. The manager wants an application that will allow him to enter the employee’s number. The application should display the employee’s employment status, either salaried or hourly. Use label controls to display the information.

a.       Create an appropriate interface. Be sure to include either a Print command button or a Print item on a file menu. The Print button or menu item should print the form.

b.      Save the form and the project.

c.       Code the application according to the information supplied in the scenario. De sure to use the MsgBox function to display appropriate messages to the user if he or she enters something other than a 1 or 2 as the second character.

d.      Save and run the application. Test the application with the following correct employee numbers: 312, 421. Print the interface after entering each employee number.

e.      Now test the application with the following incorrect employee numbers: 1A3, 167. On the printouts from step d, write down the error messages that appear after entering each of these incorrect employee numbers.

f.        Exit the application, then print the code. 

g.       Submit the printouts form step d, which contain the error messages recorded in step e and the code from step f.