5-2 pseudo

advertisement
30. A copy center charges 5 cents per copy for the first
100 copies and 3 cents per copy for each additional copy.
Write a program that requests the number of copies as
input and displays the total cost.
5 cents/copy up to 100
3 cents/copy over 100
If dblNC <= 100
dblNC*0.05
Else
$5 + (dblNC-100)*0.03
Endif
34. Write a program that requests three scores as input and
displays the average of the two highest scores. The input
and output should be handled by Sub procedures, and the
average should be determined by a user-defined function.
See earlier notes
If A>B
If B>C
A&B are largest.
Else
A&C are largest.
Endif
Else
If A>C
A&B are largest.
Else
B&C are largest.
Endif
Endif
42. Write a program that reads a test score from a text box each time a button is clicked and then displays the two
highest scores whenever a second button is clicked. Use two class-level variables to track the two highest scores. Ain’t
this really #34 with a better memory?
Private sub btn1_click
get 1 test score from the text box
find 2 largest of 3
copy them into class variables
End sub ‘btn1
Private sub btn2_click
output class variables
End sub ‘btn2
Download