class assignment
class assignment
Let the user roll numbers between 1 and 5 until they have rolled a six. When a 6 is rolled, tell
the user that they can move a piece.
Ipo:
Input Process Output
Num1 Check if number is 6
If number is 6 “You can move your piece”
Else number is 6 “Rerolling”
Pseudocode:
Start:
Declare num1, roll as integer
Display “What number did u roll”
Input num1
Input roll = 6
Loop until ‘roll’ is true
If num1<roll = false
Display “Rerolling”
else num>roll = true
Display “You can move your piece”
End
Trace Table:
Example 2: A company wants a program to calculate the wages for their five (5) workers. The
wage is equal to the rate of pay (rate) multiplied by the amount of hours worked (hrs). Utilize a
FOR loop for this question.
Ipo chart:
Pseudocode:
Start:
Declare hrs, rate, wage as integer
Display “What are the hours of the 5 workers together”
Input hrs
Display “What is the rate the 5 workers worked at”
Input rate
Wage= hrs * rate
Display “This is the wage of all workers” & wage
Trace table: