Visual Basic

01 Input Programs

Write programs which use labels and text boxes to input information and perform the following calculations. Name the programs 01???Input# where ??? is your 3 initials and # is the program number 1, 2, 3, etc.

Make the form caption be your name and the program number such as "Your Name - Input # ". Use appropriate variable names and types. In the General - Declarations of your program, use the 'Option Explicit' command. Make sure to use a val() statement to convert any text values to numeric values when appropriate.

1. Write a program that inputs a Celcius temperature and calculates the Fahrenheit temperature. Use a print statement to print the output to the form in a statement similar to 0 degrees Celcius is 32 degrees Fahrenheit.

2. Write a program which will use a text box to input the name of an item, the quantity purchased, and the price of the item. Use a label for each text box to clearly note which text box contains what data. Find the cost of the purchase (do not include tax). Display the total cost in a sentence format.

3. Write a program that inputs the number of miles a car travels and the amount of time in hours required for the trip. Calculate the speed of the vehicle in mph. Print the results to the form in sentence format similar to Driving 200 miles in 4 hours would be 50 mph.

 

Use inputboxes to input information for each problem. Print the output in sentence format to a label box.

4. Input the base and height of a right triangle. Determine the area and perimeter of the triangle. Output should be in a form such as "A right triangle with a base of 3 in. and a height of 4 in. has an area of 6 sq in and a perimeter of 12 inches."

5. A coin is flipped repeatedly. The number of heads and tails is recorded. Write a program that inputs the number of heads and tails that occurred and outputs the percentage of heads and tails.

6. Write a program that inputs an item name, the price of an item and the percentage discount to be applied to the price. Calculate the discounted price and amount of the discount on the item.

Visual Basic Assignment Page

 
51945
 
© 2004-2008, Jerel L. Welker
Page Updated: January 15, 2009