Display the ATM Transaction in C# – Programming, Pseudocode Example, C# Programming Example
C# C# Console

Display the ATM Transaction in C#

In this C# example, we are performing the ATM Transaction. The types of ATM transaction are

1) Balance Checking,  2) Cash Withdrawal ,3) Cash Deposition, 4)Quit

We are reading the pin number using ‘pin’ variable. If condition statement is used to check the value of ‘pin’ variable is not equal to 1520. If the condition is true, then execute the statement.

Print the statement as please enter valid password.

Do-While statement is used to print the types of ATM transaction.

The ‘choice’ variable is used to select anyone types of transaction. Use the value of ‘choice’ variable in the switch case statement. Case1 is used to print the available balance from the value of ‘amount’ variable. To withdraw the amount case2 statement is used.

Read the amount to withdraw using ‘withdraw’ variable. Nested If-Else condition statement is used to check the modulus of the value of ‘withdraw’ variable by 100 is not equal to 0. If the condition is true then print the statement as “please enter the amount in multiples of 100”.

Otherwise, if the condition is false, then execute the else if condition statement. Check the difference between the values of ‘amount’ variable by 500 is less than the value of ‘withdraw’ variable. Once the condition is true then execute the statement and print the statement as insufficient balance.

Otherwise, if the condition is false, execute the else condition statement. Assign the difference between the values of ‘amount’ variable by the value of ‘withdraw’ variable. Print the statement as please collect cash and your current balance using the value of ‘amount’ variable value.

To deposit the amount case3 statement is used to get the amount to deposit using deposit variable and assigns the resulted value to amount variable. Compute the summation of the value of ‘amount’ variable with the value of ‘deposit’ variable. Print the statement as the balance using amount variable value.

C# Code:

The C# program is successfully compiled and executed with Microsoft Visual Studio. The program output is also shown below.

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.