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

Write an algorithm for an ATM program. Think about where there would be selectio

ID: 3806436 • Letter: W

Question

Write an algorithm for an ATM program. Think about where there would be selection statements, menus, loops (counted vs. conditional), etc. – but – don’t write MATLAB code, just an algorithm (pseudo-code).

I know the MatLab code would be:

balance = 500;
pin = input('Enter PIN');
c = menu('Choose:','deposit','withdraw','display','return card'); while(c<4)
switch c
case 1 x = input('Add how much?');
if(x>0) balance = balance+x;
end
case 2 x = input('Withdraw how much?');
balance = balance-x;
else
error('Insufficient Funds');
end
case 3
fprintf('Your money is at %.2f ', balance);
case 4
fprintf('Your money is at %.2f ', balance);
break;
end
c = menu('Choose:','deposit','withdraw','display','return card');
end
else disp('Incorrect PIN.');
end

**But I need to make this just an algorithm (pseudo-code)!

Explanation / Answer

Below is the pseducode for the ATM program

The main program is called MAINPROGRAM

PROCEDURE MAINPROGRAM

BEGIN

    LOOP

        IF system is disabled

            THEN BEGIN

                display 'out of service' message

                LOOP UNTIL system is enabled

            END

            ELSE IF no card is inserted

                THEN display 'insert card' message

                ELSE CALL PROCEDURE VALIDATEPIN

            ENDIF

        ENDIF

    ENDLOOP

END MAINPROGRAM

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