Wharton Class Due: Tuesday, September 16th @ 8:45am
FBTC Class Due: Wednesday, September 17th @ 10:15am
M/C Questions 1 – 15, pp. 113-4 (30 pts. total – 2 pts. ea.)
1. c
2. a
3. d
4. b
5. d
6.a
7.d
8. b
9. c
10. a
11. d
12. b
13. a
14. d
15. b
T/F Questions 1 – 12, p.115 (12 pts. total – 1 pt. ea.)
1. f
2. t
3. t
4. f
5. f
6. t
7. f
8. t
9. t
10.f
11. f
12. t
Algorithm Workbench #1 - #7, pp.115-6 – Write pseudocode (not Java) (21 pts. total)
1. Module Main()
Declare userNum as Integer
Display "Enter a number" input userNum call TimesTen(userNum)
Display userNum
End
Function TimesTen(integer userNum) userNum = (userNum * 10) return userNum
End Function
Algorithm Workbench #1 - #7, pp. 115-6 (continued) – Write pseudocode (not Java)
2. def main(): showvalue() def showvalue(): print '12'
main()
3.
The value stored in ‘a’ will be: 3
The value stored in ‘b’ will be: 2
The value stored in ‘c’ will be: 1
4.
5.
6.
7.
Debugging Exercises, p.117 (3 pts. Ea. / 12 pts. Total )
1.
2.
3.
4.
Programming Exercises, (#1 - p.117) (10 points total)
#1. Kilometer Converter
Design a modular program that asks the user to enter a distance in kilometers, and the converts that distance to miles. The conversion formula is as follows:
Miles = Kilometers * 0.6214
Additional Instructions:
1. Design using pseudocode.
2. Use the following module names: getKilometers – read kilometers from user keyboard input and store in ‘kilometers’ variable showMiles – accepts ‘kilometers’ variable as input argument and displays the equivalent value in miles
Module main () Declare Real kilometers Call getKilometers (kilometers) Call showMiles (kilometers)
End Module
Module getKilometers (Real Ref kilometers) Display “Enter distance in kilometers” Input kilometers
End Module
Module