PPA115D-TRO115D Issue 2 Umsebenzi - LOD
PPA115D-TRO115D Issue 2 Umsebenzi - LOD
PPA115D-TRO115D Issue 2 Umsebenzi - LOD
2 2024 S2
Purpose:
• To prepare students with understanding on how to use selection control structure in a
program.
eg. A child’s age may not exceed 11. // age is the variable that you will use
If age <= 11 then
If age < 12 then
a. A person’s salary is equal to R30 000
b. A person’s age is 35 and above as well as the height
c. Months of the year may not exceed 12
d. Current year must not be equal -1
1.2 Write only the suitable if statement in pseudocode for the following conditions.
Make use of the variable names as provided.
eg. A child’s age may not exceed 12 years, display “You are a child”; else “You are
an adult” . // age is the variable that you will use
If age <= 11 then
Display “ You are a child”
Else
Display “ You not a child”
End
or
If age < 12 then
Display “ You are a child”
Else
Display “ You not a child”
End
PPA115D/TRO115D 2022 S1 - Umsebenzi Issue 1
1
a. If an angle is equal to 180 degrees, display the message “The angle is a straight
angle”; else display the message “The angle is not a straight angle”.
b. If the difference between weight1 and wieght2 exceeds 9.5 kg calculate the mass
of both dogs.
c. If the value p is greater than the sum of q and r and s is less than 20, then prompt
the user for the t value.
d. If money is left in particular bank for more than 8 years, the bank pays interest at
a rate of 4.5%, otherwise, the interest rate is 3.0%.
2.1 Deterimine the value of the following expressions, assuming x = 10, y = 4, z = 8, a= 12, b
= 3:
Pseudocode Expression Java expression Value
x>y
x <> b
A mod y = z mod y
x=y
The interest rate paid on funds deposited in a bank is determined by the amount of time
the money is left on deposit.
Sample output:
Figure 3.1:
Figure 3.2
Students in Programming 1 had written a test and they need to know their performance.
Write a Java application that will help them achieve this using the information given below:
Figure 4.1:
Figure 4.2:
A student in Programming 1 wants to know the surface area and volume of a cylindrical shape.
5.4 Write a corresponding C++ code for the above problem statement, using a switch statement.