Visual BASIC Assignments
Assignment for Wednesday, November 4, 2009
High Low Guessing Game
Write a VB program which is a computer guessing game.
Have the computer generate a random number from 1 to 100, inclusive.
Have the computer prompt the user to enter a guess from 1 to 100.
After each guess, have the computer tell the user if the guess was too high or too low.
When the number is finally guessed, display the number of guesses it took.
Make sure the text box contains numeric data.
Make sure the text box contains numbers from 1 to 100.
Assignment due Monday, November 2, 2009
Addition Tutor
Create a addition tutor application that displays addition problems by randomly generating two numbers, -25 through 25, and prompts the user for the answer which is the sum of the 2 numbers.
The application will determine if the answer is correct or incorrect and will generate a new problem. If an incorrect answer is given, the program should display the correct answer. Remember that some variables need to be declared globally. (Similar to Page 125 #10)
Assignment due Tuesday, October 26, 2009
Page 122 Exercise 3 - Printing Prices
You will need to use IF... Then... ElseIf... ElseIf... Else... End If.
Assignment for Friday, October 23
Page 121 Exercise 2a – Payroll
Assignment for Wednesday, October 21
Visual BASIC Triangle Assignment
Write a VB program that will determine the type of a triangle.
Design an attractive and easy to use interface (form) that will allow the user to enter 3 numbers which represent the lengths of the 3 sides of a triangle. The form should also contain a button to start the analysis and a label or listbox to display the answer. As usual, the completed assignment will include a working menu with File, Exit, Help and About.
The program should first check that 3 numbers are entered, that is, no text box is empty and no text box contains a nonnumeric value. Use the IsNumeric function to check that a number has been entered. .
The program must then determine if the numbers make any triangle. You cannot have a triangle with sides 2, 3 and 7. You cannot have a triangle with sides 2, 3 and 5.
If the numbers make a triangle, the program should determine if the triangle is equilateral, isosceles or scalene.
Use labels, listboxes or messageboxes to display the results.
Assignment for Thursday, October 15
Page 121 Exercise 1 – Number of Digits
Assignment for Wednesday, October 7
Page 92 Exercise 8a – Digits of a Number
This program requires the use of "\" (integer division) and "mod" (modulus).
What is the result of intNumber \ 10 ?
What is the result of intNumber mod 10 ?
Include &File, E&xit, &Help, and &About menu items.
Include code for the textbox text_changed event.
Use the Val function to prevent your program from crashing if a person doesn’t enter a number or leaves the textbox empty.
Remember to include comments with you name, program title, and date.
Assignment for Monday, October 5
Page 91 Exercise 7 - Change
This program requires the use of "\" (integer division) and "mod".
What is the result of: intChange \ 25 ?
What is the result of: intChange mod 25 ?
Include &File, E&xit, &Help, &About menu items.
Remember to include comments with you name, program title, and date.
Use multiple labels or a listbox to display the answers.
Include a textchanged event to clear old answers.
Assignment for Thursday, October 1
Page 91 Exercise 6 - Long Jump Average
Use the Single or Double data type so that you can enter decimals.
Use the Val function.
Write code for the TextChanged event to clear the text boxes.
Include an About form and File, Exit, Help, About menu items
Assignment for Tuesday, September 29
Page 89 Exercise 2a - Fahrenheit to Celsius Temperature Conversion
Make sure you:
1 include your full name in the form's text property e.g., John Smith's Termperature Conversion
2 add a file, exit menu
3 accompany text boxes with appropriate prompts
4 Dim intFahrenheit as Integer
5 use the formula 5/9 * (intFahrenheit - 32)
6 use the proper naming convention (textbox "txt", label "lbl", button "btn")
7 add code to the textbox TextChanged event to clear the old answer
Save the entire folder onto your flash drive then copy that folder onto your folder on the middle computer.
Assignment for Friday, September 25
Rectangle Area and Perimeter
Page 90 Exercise 3
Assignment for Wednesday, September 23
Text Book Page 60 Exercise 3 - Band Information
Add a menu with File and Exit to your form.
Make sure you follow the proper naming conventions: label names begin with "lbl", button names begin with "btn", groupbox names begin with "grp", radio button names begin with "rad", menu items begin with "mnu".
When saving your project, make sure the “create new folder” check box is checked so there will be a separate folder created for each program. Copy the entire folder onto your flash drive. In school you will copy the folder from your flash drive onto the middle computer in the front of the computer room.
Assignment for Monday, September 21
Complete the Hello-GoodBye Program on Page 62 #4.
Bring the Flash Drive and Textbook to every class.