Question: 5. Write an algorithm that, given a bank account balance, classifies and prints the account status as overdrawn if the balance is negative, empty if
5. Write an algorithm that, given a bank account balance, classifies and prints the account status as overdrawn if the balance is negative, empty if the balance is zero, and funded if the balance is positive. You may assume that actions such as the following can be done in a single step:
1. comparing two numbers and
2. printing an account status.
6. Given two different moves in the game rock-paper-scissors, write an algorithm to determine which move won. You may assume that actions such as the following can be done in a single step:
1.checking if a move is rock,
2.checking if a move is paper,
3.checking if a move is scissors,
4.printing a move.
7. Write an algorithm to, given the current time of day and day of the week, lock or unlock the entry door for a store that opens at 8:00 a.m., closes at 5:00 p.m. on weekdays, and is closed on weekends. You may assume that actions such as the following can be done in a single step:
1. comparing two times to see which is earlier,
2. comparing two days to see which comes earlier in the week (assume that the week runs from Sunday to Saturday rather than from Monday to Sunday),
3. locking the door, and
4. unlocking the door.
8. Write an algorithm that will be run every second to update a turn signal light. While the drivers turn signal is active, the algorithm should switch the light back and forth between on and off, but otherwise the light should turn off.
1. determining if the driver has the turn signal activated,
2. determining if the turn signal light is on or off,
3. changing the turn signal light to on, and
4. changing the turn signal light to off.
The resulting algorithm, written in pseudocode (another output of the Solution Design & Expression activity). Because we have provided little instruction on how to write pseudocode, use the example from the textbook as a guide; use if and then to indicate steps that only need to be taken some of the time.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
