Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an algorithm that, given a bank account balance, classifies and prints the

ID: 3743721 • Letter: W

Question

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:

comparing two numbers and

printing an account status.

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:

checking if a move is “rock”,

checking if a move is “paper”,

checking if a move is “scissors”,

printing a move.

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:

comparing two times to see which is earlier,

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),

locking the door, and

unlocking the door.

Write an algorithm that will be run every second to update a turn signal light. While the driver’s turn signal is active, the algorithm should switch the light back and forth between on and off, but otherwise the light should turn off.

determining if the driver has the turn signal activated,

determining if the turn signal light is on or off,

changing the turn signal light to on, and

changing the turn signal light to off.

Explanation / Answer

I am writing all the required algorithm below with proper explaination Note that i am giving you algorithm as specified not code but if you want code then write in comment section i will provide it

a)

1. Take input for balance

2. Check if balance is negative then set the status variable to overdrawn

3. Else check if balance is zero then set the status variable to empty

4. Else the status variable to funded

5. Print the status

b)

1. Take input for both moves

2. Check if move1 is rock then

i Check if move2 is rock then set the result variable to "draw"

ii Else check if move2 is paper then set the result variable to "move1 won"

iii Else set the result variable to "move2 won"

3. Else check if move1 is paper then

i  Check if move2 is rock then set the result variable to "move1 won"

ii Else check if move2 is paper then set the result variable to "draw"

iii Else set the result variable to "move2 won"

4. Else

i  Check if move2 is rock then set the result variable to "move2 won"

ii Else check if move2 is paper then set the result variable to "move1 won"

iii Else set the result variable to "draw"

5. Print the result

c)

1. Take input for time and day

2. Check if day is saturday or sunday then

set status to "locked"

3. Else

i  Check if time is less than 8 am or greater than 5 pm than

set status to "locked"

ii Else

set status to "Unlocked"

4. Print the status

d)

1. Initialize a time variable by 0

Run an infinite loop

do

2. Turn signal of the light off,

3. Check if the driver has the turn signal activated then

i. if the turn signal light is off then

turn the signal light on

4. increment time by 1

Hope i have answered your question satisfactorily.Leave doubts in comment section if any.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote