Docsity

Lab Practice Questions - Application Programming Information Systems | IST 256, Lab Reports of Information Technology

Toggle sidebar
bg1
IST 256
Lab 10 – February 18, 2008
1. Understanding if statements (practice question)
Given the following program fragment with the variable carID as an integer and Type as a
string:
If carID < 100 Then
Type = “modelA”
Else
Type = “modelT”
End if
If carID < 50 Then
Type = “modelZ”
End if
If the value of carID is 25 before these statements, what is the value of Type afterwards?
If the value of carID is 75, what is Type?
If the value of carID is 125, what is Type?
2. Writing a Loop (practice question)
Suppose that every year, I plan to save $150 in my bank account. My initial balance is
$500 (and I am not going to get any interest). How much money will I have in my
account after 5 years? Declare the variable balance and any other variables that you need
and write a loop that will compute the final balance.
pf2

Partial preview of the text

Download Lab Practice Questions - Application Programming Information Systems | IST 256 and more Lab Reports Information Technology in PDF only on Docsity!

IST 256

Lab 10 – February 18, 2008

1. Understanding if statements (practice question)

Given the following program fragment with the variable carID as an integer and Type as a string:

If carID < 100 Then Type = “modelA” Else Type = “modelT” End if If carID < 50 Then Type = “modelZ” End if

If the value of carID is 25 before these statements, what is the value of Type afterwards?

If the value of carID is 75, what is Type?

If the value of carID is 125, what is Type?

2. Writing a Loop (practice question)

Suppose that every year, I plan to save $150 in my bank account. My initial balance is $500 (and I am not going to get any interest). How much money will I have in my account after 5 years? Declare the variable balance and any other variables that you need and write a loop that will compute the final balance.

3. General Procedure

Start a new project and name it something like SimpleProc (for simple procedure).

Create the user interface for the simple procedure demonstrated in class that has three buttons:

Double the number 17 Double the number - Close

Use the code given on the web page for the twice procedure and for the buttons. Test this program to make sure that all the buttons work.

Now change the program so that is triples two (different) numbers.

  • Change the button text to say: Triple the number 15 and Triple the number -
  • Change the code for the procedure so that its name is Triple and it takes the number * 3
  • Change the code for each button so that the first one calls Triple with 15 and the second one calls Triple with -

Test your program to make sure that it works.