 ``` Machine Problem

Create and design a program that simulates an Automatic Teller Machine. The money  bill to be used in the program will be 1000,500,200 and 100 money bill denomination.

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 at 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 mobile number here in the Philippines is 09173084360.

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

Want to support my channel?

GCash Account

09173084360

Paypal

Patreon

Thank you very much for your support.
```
``````/* atm.scala
Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
January 8, 2022  7:58 PM Saturday
Bacolod City, Negros Occidental
*/

import java.util.Scanner;

object  atm {

def main(args: Array[String]) : Unit = {

var scanner = new Scanner(System.in);

var bill1000=0; var bill500=0; var bill200=0; var bill100=0;
var total_balance=0; var withdraw=0; var money_left=0;
var withdraw_again='n';

do

{

print("\n");
print("\tAutomatic Teller Machine Simulation in Scala");
print("\n\n");
print("\tHow many P1000 bills: ");
bill1000 = scanner.nextInt();

print("\tHow many P500 bills: ");
bill500 = scanner.nextInt();

print("\tHow many PHP 200 bills: ");
bill200 = scanner.nextInt();

print("\tHow many PHP 100 bills: ");
bill100 = scanner.nextInt();

total_balance = (bill1000 * 1000)+(bill500 * 500) + (bill200 * 200) +  (bill100 * 100) ;
print("\n\n");

print("\tTotal Balance: PHP " + total_balance);

print("\n\n");
print("\tEnter amount to withdraw: PHP ");
withdraw = scanner.nextInt();

money_left = withdraw ;

if  (withdraw > total_balance)
{
print("\tWithdraw amount greater than total balance.  ");
print("\n");
}
if (withdraw < total_balance)
{

if  (money_left >= 1000 )
{

money_left = money_left - (receive1000 * 1000);
}

if  (money_left >= 500 )
{

money_left = money_left - (receive500 * 500);
}

if (money_left >= 200 )
{
money_left = money_left - (receive200 * 200);
}

if (money_left >= 100 )
{
money_left = money_left - (receive100 * 100);
}

print("\n\n");
print("\n\n");
print("\tPHP 1000 bill :=>  " + receive1000);
print("\n");
print("\tPHP 500 bill :=>   " + receive500);
print("\n");
print("\tPHP 200 bill :=>   " + receive200);
print("\n");
print("\tPHP 100 bill :=>   " + receive100);
print("\n\n");

total_balance = total_balance - withdraw;

print("\tYour current balance is: PHP "  + total_balance);

print("\n\n");
print("\tYou only have balance of:");
print("\n\n");
print("\tPHP 1000 bill :=>  " +  bill1000);
print("\n");
print("\tPHP 500 bill  :=>  "  + bill500);
print("\n");
print("\tPHP 200 bill  :=>  "  + bill200);
print("\n");
print("\tPHP 100 bill  :=>  "  + bill100)
print("\n\n");
printf("\tAnother Withdraw Again ? Y/N : ");
}
}  while (withdraw_again.toUpper == 'Y');
print("\n");
print("\tEnd of Program");
print("\n\n");

}
}``````