Westonci.ca is the premier destination for reliable answers to your questions, provided by a community of experts. Discover detailed answers to your questions from a wide network of experts on our comprehensive Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

ALL questions on the worksheet must be completed and updated in your Electronic Portfolio to gain full marks. The
compulsory questions contribute 60% of the overall marks. The remaining questions will contribute 30% and 10%
will be awarded for presentation, neatness and indentations. The requirement for each question is provided at the
end.

1. Using pseudocode AND flowcharts and PYTHON, redo the following using the NESTED IF structure to develop IF
selection patterns that will evaluate a character variable called vacType and print one of the following messages,
depending on its value:
(i) “Cruise”, if the value of vacType is C
(ii) “Hotel”, if the value of vacType is H
(iii) “Flight”, if the value of vacType is F
(iv) “Invalid”, if vacType has any other value.
No trace table and IPO chart required for question one above
Question 2 - Compulsory
2. Design a program to display the following menu:
1. Convert Miles to Yards
2. Covert Miles to Feet
3. Convert Miles to Inches
It then prompts the user to enter a choice (of 1, 2 or 3) and distance in miles. Then it calculates and display the
required value. It is given that:
• 1 mile = 1760 yards
• 1 mile = 5280 feet
• 1 mile = 63360 inches

Assume valid values are entered. (IPO, pseudocode, trace table, C and PYTHON required)
3. Write the pseudocode corresponding to the following flowchart:

Convert your answer into a sequential-if structure and draw the flowchart accordingly.

2

4. Effective July 2016, the new income tax threshold and tax rate moved to the following:

Design a program that will prompt for a person’s salary and calculate and display the income tax and net
income. (IPO, flowchart, C and PYTHON required)
Design a program that prompts the user to enter an integer and ten display a message indicating whether
the number is exactly divisible 3 and by 4; otherwise the message “NN is not what you are looking for!”.
Where NN is the given number. For example, 12 is directly divisible by 3 and 4. Assume all inputs are valid.
(IPO, Flowchart, C, PYTHON and mapping table required.)

Question 5 - Compulsory
5. Consider the following pseudocode design for determining the speed of a person traveling in a residential
area. The more the speed limit is exceeded, the greater the fine applicable. Answer the questions that
follow:
LINE 1 START
LINE 2 DECLARE speed AS INTEGER
LINE 3 PRINT “Enter traveling speed: ”
LINE 4 READ speed
LINE 5 IF speed > 50 then
LINE 6 fine = 2000
LINE 7 ELSE
LINE 8 IF speed > 80 then
LINE 9 fine = 4000
LINE 10 ELSE
LINE 11 IF speed > 120 then
LINE 12 fine = 7000
LINE 13 ELSE
LINE 14 fine = 0
LINE 15 PRINT “No fine.”
LINE 16 END IF
LINE 17 END IF
LINE 18 END IF
LINE 19 PRINT “Your fine is: “, fine
LINE 20 PRINT “Have a nice day!”
LINE 21 STOP

(a) With the aid of a trace table, write the output that would be displayed for the variable fine after tracing
through the above pseudocode (the NESTED-IF design) if the user entered the following data for speed?
Speed
50
90
140
35

(b) Based on your evaluation, is the pseudocode above correct or incorrect? Justify your answer, and state how, if at
all, the pseudocode should be corrected.