Wednesday, April 3, 2019

Automatic Teller Machine Simulation in Go

Here is a sample program that we wrote to simulate automatic teller machine using Go programming language. I hope you will find our code useful in learning Go.

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.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output

Program Listing

/* atm.go   Written By :   Jake R. Pomperada   Rollyn M. Moises   Sunday Vince V. Latergo   April 3, 2019 Wednesday   Bacolod City, Negros Occidental*/
package main

import "fmt"
var bill1000,bill500,bill100,bill200,total_balance int32;
var withdraw, money_left int32;
var recieve1000,recieve500,recieve200,recieve100 int32;

func main(){
   fmt.Print("\n");
   fmt.Print("\tAutomatic Teller Machine Simulation");
   fmt.Print("\n\n");
   fmt.Print("\tHow many P1000 bills: ");
   fmt.Scanln( &bill1000);
   fmt.Print("\tHow many P500 bills: ");
   fmt.Scanln(&bill500);
   fmt.Print("\tHow many PHP 200 bills: ");
   fmt.Scanln(&bill200);
   fmt.Print("\tHow many PHP 100 bills: ");
   fmt.Scanln(&bill100);
   total_balance = (bill1000 * 1000)+(bill500 * 500) + (bill200 * 200) +  (bill100 * 100) ;
   fmt.Print("\n\n");
   fmt.Print("\tTotal Balance: PHP ", total_balance);
   fmt.Print("\n\n");
      fmt.Print("\tEnter amount to withdraw: PHP ");
      fmt.Scanln(&withdraw);
      money_left = withdraw ;
      if  (withdraw > total_balance) {
         fmt.Print("\tWithdraw amount greater than total balance.  ");
         fmt.Print("\n");
      }
      if (withdraw < total_balance)     {

         if  (money_left >= 1000 ) {
            recieve1000 = (money_left / 1000);
            if (recieve1000 > bill1000) {
               recieve1000 = bill1000;
               money_left = money_left - (recieve1000 * 1000);
               bill1000 = bill1000 - recieve1000;
            }
         }
      }
         if  (money_left >= 500 )   {
            recieve500 = (money_left / 500);
            if (recieve500 > bill500 ) {
               recieve500 = bill500;
            }
            money_left = money_left - (recieve500 * 500);
            bill500 = bill500 - recieve500;
         }

         if (money_left >= 200 ) {
            recieve200 = (money_left / 200);
            if (recieve200 > bill200) {
               recieve200 = bill200;
               money_left = money_left - (recieve200 * 200);
               bill200 = bill200 - recieve200;
            }
         }

         if (money_left >= 100 )    {
            recieve100 =(money_left / 100);
            if (recieve100 > bill100 ) {
               recieve100 = bill100;
            }
            money_left = money_left - (recieve100 * 100);
            bill100 = bill100 - recieve100;
         }

         fmt.Print("\tYou will receive:");
         fmt.Print("\n");
         fmt.Print("\tPHP 1000 bill :=> ", recieve1000);
         fmt.Print("\n");
         fmt.Print("\tPHP 500 bill :=>  ", recieve500);
         fmt.Print("\n");
         fmt.Print("\tPHP 200 bill :=>  ", recieve200);
         fmt.Print("\n");
         fmt.Print("\tPHP 100 bill :=>  ", recieve100);
         fmt.Print("\n\n");

         total_balance = total_balance - withdraw;

         fmt.Print("\tYour current balance is: PHP ",total_balance);
         fmt.Print("\n");
         fmt.Print("\tYou only have balance of:");
         fmt.Print("\n");
         fmt.Print("\tPHP 1000 bill :=> ",bill1000);
         fmt.Print("\n");
         fmt.Print("\tPHP 500 bill  :=> ",bill500);
         fmt.Print("\n");
         fmt.Print("\tPHP 200 bill  :=> ",bill200);
         fmt.Print("\n");
         fmt.Print("\tPHP 100 bill  :=> ",bill100);
         fmt.Print("\n\n");
         fmt.Print("\tEnd of Program");
         fmt.Print("\n");
}





No comments:

Post a Comment