Tuesday, June 7, 2022

Automatic Teller Machine in C

 A simple automatic teller machine using a C programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

#include <stdio.h>


float balance = 0; 

int anotherTransaction=0; 

int amountToWidthdraw=0; 

int amountToDeposit=0; 


void Main_Menu(){

  int choice=0; 

  

  printf("\n");

  printf("Automatic Teller Machine in C\n\n");

  printf("[1] Withdraw Money\n"); 

  printf("[2] Deposit Money\n"); 

  printf("[3] Check Balance\n");

  printf("[4] Quit Program\n\n\n");

  printf("Select Your Choice :" );

  scanf("%d",  &choice); 

  printf("\n");

  

  switch(choice){

    case 1:

   

    printf("Please enter amount to withdraw: "); 

    scanf("%d", &amountToWidthdraw); 

    if(amountToWidthdraw > balance){

      printf("There is no insuffient funds in your account"); 

      

      printf("\n\nDo you want another transaction?\nPress 1 to proceed and 2 to exit\n\n"); 

      scanf("%d", &anotherTransaction); 

      if(anotherTransaction == 1){

       

       Main_Menu();

      }

    } else {

      

      balance = balance - amountToWidthdraw; 

      

      printf("You have withdrawn %d and your new balance is %5.2f ", amountToWidthdraw, balance);

      

      

      printf("\n\nDo you want another transaction?\nPress 1 to proceed and 2 to exit\n\n"); 

      scanf("%d", &anotherTransaction); 

      if(anotherTransaction == 1){

      

        Main_Menu();

      }

      else {

      Main_Menu();

  }

      

    }

    break; 

    

    case 2:

      

    

    printf("Please enter amount to deposit: "); 

    scanf("%d", &amountToDeposit); 


    

    balance = amountToDeposit + balance; 

    

    printf("Thank you for depositing, new balance is: %5.2f", balance); 

    

        printf("\n\nDo you want another transaction?\nPress 1 to proceed and 2 to exit\n\n"); 

      scanf("%d", &anotherTransaction); 

      if(anotherTransaction == 1){

       

        Main_Menu();

      } else {

      Main_Menu();

  }

    

    break; 

    

    case 3:

    

    

    printf("Your bank balance is: %5.2f", balance); 

    

   

      printf("\n\nDo you want another transaction?\nPress 1 to proceed and 2 to exit\n\n"); 

      scanf("%d", &anotherTransaction); 

      if(anotherTransaction == 1){

      Main_Menu();

      } else {

      Main_Menu();

  }

    

    break;

    

    case 4:

      printf("\n");

      printf("\tThank you for using this software.");

      break;

  }

  

}




int main(){

  

  

  Main_Menu();

  return 0;

}

No comments:

Post a Comment