Unit 3 Assignment 1

455 Words2 Pages
November 1, 2013 Unit 3 homework 3 Short answer 5. Write a pseudo code statement that declares the variable cost so it can hold real numbers? long cost int total count=220 total=10+210 totalfee=total-downPayment 6. Write a pseudo code statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Declare Real price=61.95 Display "the original price." Input item original price Display "price" Algorithm workbench 3. Write assignment statements that perform the following operations with the variables a, b, and c. a = b * 4, b = a / 3.14, a = b – 8 4 Assume w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements? result = x + y; // 12 result = z * 2; // 4 result = y / x; // 2 result = y - z; // 6 result = w % 2; // 1 5. Assuming there are no accidents or delays, the distance that a car travels down the interstate can be calculated with the following formula: Distance = Speed * Time Acar is traveling at 60 miles per hour. Design a program that displays the following: The distance the car will travel in 5 hours The distance the car will travel in 8 hours The distance the car will travel in 12 hours. . Private Sub cmdcalculate_click() Dim d1 as integer 'this is how to declare local variable Dim d2 as integer Dim d3 as integer Dim speed as integer Dim t1 as integer 'this refer to 5 hours Dim t2 as integer 'this is refer to 8 hours Dim t3 as integer 'this is refer to 12 hours Speed=60 t1=5 t2=8 t3=12 d1=speed*t1 'd1 to get the first distance travel which is 5 hours d2=speed*t2 'd2 to get the second distance travel which is 8 hours d3=speed*3 'd1 to get the third distance travel which is 12 hours End Sub Private Sub cmdExit_click() end End Sub 6. 7. A car's miles-per-gallon (MPG can be

More about Unit 3 Assignment 1

Open Document