Wednesday, August 03, 2005

Tafe : Geoff : week 3 : Pseudocode Exercises... Amended


Pseudocode Exercises: Marks: 30%

Write pseudocode for each of the following program specifications.

1. The user is to enter a temperature in centigrade and you are you convert it to Fahrenheit and display the result. The formula is F=C*9/5+32.

2. The same as 1 above but only convert the temperature if the entered value is less than 101C

3. The same as 2 above but limit the input temperatures between -10C and 50C.

4. As for 3 above but keep asking for more temperatures to convert until the user enters the word EXIT.

5. The user must enter an exchange rate and an amount of Australian Dollars. The program shows how much of the original currency can be purchased. Thus if the exchange rate is .7 and there are $AU10 then the output is $7.00.

6. As for 5 above but make sure that the user does not enter a negative amount to convert.

7. A pilot knows that pressure drops by 1HP (Hecto Pascal) for every 30 feet increase in altitude. Write a program to ask for the pressure in HP at sea level and a cruising altitude (which must be > 0). Calculate and display the pressure at the cruising altitude.

8. Modify the program for 7 above to add a temperature estimate, given that the temperature will drop by 1.5 degrees C for every 1000 feet of altitude.


Instructions:
Complete the above exercises and submit to your teacher for marking by the end of week 4 of semester. These exercises are worth 30% of your overall mark for this unit.
You must obtain a pass mark for these exercises in order to pass the unit.

Late submissions will NOT be marked, unless accompanied by a medical certificate or a documented legitimate reason which must be submitted within one week of the due date.

Psudocode/Standard English.

"I am using Alphabetical increments for Processing not Recall purposes."
(1)
Begin A=0 B=0
Input A=TRUE
B=A*9/5+32
Output "Temperature", B
End

(2)
Begin A=0 B=0
Input A<101
B=A*9/5+32
Output "Temperature", B
End

(3)
Begin A=0 B=0
Input A Between -10 and 50
B=A*9/5+32
Output "Temperature", B
End

"15-20 Years of programming has led me to use the declarations in a horizontal plane. To allow for extra varianbles to be added."
(4)
Begin B=0
INPUT A
WHILE A != "EXIT" and Between -10 & 50
B=A*9/5+32
Output B
INPUT A
End WHILE
End

(5)
Begin A=0 B=0
Input A=True
Output A
B=A*(70/100)
Output B
End

"Limiters should be applied at the Declaration on the variable, "Like DTDs Or Schemas".
(6)
Begin A>=0 B>=0
Input A>0
Output A
B=A*(70/100)
Output B
End

"Combined output saves on multiple Lines"
(7)
Begin A=0 B=0 C=0
output ""sea level pressure?"
Input A
Output "cruising altitude?"
Input B > 0
C=A+(B/30)
Output "Pressure at crusing altitude equals", C
End

(8)
Begin A=0 B=0 C=0 D=0 E=0
Output "sea Level Pressure?"
Input A
Output "cruising altitude?"
Input B > 0
Output "Current Temperature?"
Input C
D=A+(B/30)
E=C-((3/2)*(B/1000))
Output " Cruising Pressure", D
Output "Cruising Temperature", E
End

0 Comments:

Post a Comment

<< Home