152,177 views
4 votes
4 votes
5. An ATM allows a customer to withdraw a maximum of $400. If the customer withdraws more than $200, the service charge is 3% of only the amount over $200. If the customer does not have sufficient money in the account, the ATM informs the customer about the insufficient funds and gives the customer the option to withdraw the money for a service charge of $30.

User EyeQ Tech
by
2.9k points

1 Answer

4 votes
4 votes

Answer:

//algorithm for ATM money withdrawal

Algorithm: Algorithm for cash withdrawals from ATM.

Input: withdraw_amount

Output: amount+service_charges.

Algorithm:

step 1:

balance =account balance.

withdraw_amount = (Get input from user)

step 2:

if(withdraw_amount>400)

then, print "maximum limit exceeds"

step 3:

if(withdraw_amout<1)

then, print "enter a valid amount"

step 4:

if(withdraw_amount>balance)

then, print "insufficient balance.. withdraw money $30 as service charges "

step 5:

if(withdraw_amount<400 && withdraw_amount<balance)

if(withdraw_amount>200)

service_charge=withdraw_amount*(3/100)

print " Your cash is dispensed... total amount withdrawn +service_charges 30% (withdraw_amount +service_charge) "

User Woodford
by
3.0k points