NEED JAVA SOURCE CODE This project is to develop an application software for ATM
ID: 3741046 • Letter: N
Question
NEED JAVA SOURCE CODE
This project is to develop an application software for ATM having a customer console (keyboard and display) for interaction with the customer, a printer for printing customer receipts, and a key-operated switch to allow an operator to start or stop the machine.
The ATM must be able to provide the following services to the customer:
- 1. A customer must be able to make a cash withdrawal from any suitable account, in multiples of $20.00.
Approval must be obtained from the bank before cash is dispensed. (25 points)
- 2. A customer must be able to make a deposit to any account, consisting of cash and/or checks in an envelope. The customer will enter the amount of the deposit into the ATM, subject to manual verification when the envelope is removed from the machine by an operator. Approval must be obtained from the bank before physically accepting the envelope. (25 points)
- 3. A customer must be able to make a balance inquiry of any linked account. (20 points)
A customer must be able to abort a transaction in progress by pressing the Cancel key instead of responding
to a request from the machine.
Classes:
- ATM: Class ATM represents the ATM as a whole.
- Keypad : Class keypad is responsible for receiving all user input.
- Screen : Class Screen is responsible for displaying output to the user.
- Account : Class Account represents a bank account. Each Account has four attributes – accountNumber, pin, availableBalance and totalBalance( the amount of funds available + the amount of deposited funds wtill pending confirmation).
- Transaction (abstract class) : Class Transaction is an abstract superclass that represents the notion of an ATM transaction. It contains the common features of subclasses BalanceInquiry, Withdrawal and Deposit.
- BankDatabase : Class BankDatabase models the bank’s database with which the ATM interacts to access and modify a user’s account information.
- BalanceInquiry : Class BalanceInquiry extends Transaction and represents a balance inquiry ATM transaction.
- Withdrawal : Class Withdrawal extends Transaction and represents a withdrawal ATM transaction. - Deposit : Class Deposit extends Transaction and represents a deposit ATM transaction.
Explanation / Answer
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ATM;
import java.util.*;
/**
*
* @author Prashant Tomer
*/
class Keypad {
public int input()
{
int choice;
Scanner sc=new Scanner(System.in);
choice=sc.nextInt();
return choice;
}
}
class Screen
{
public void screen()
{
System.out.println("Welcome To ABC Bank");
System.out.println("Enter your choioce 1. Withdraw Money 2.Deposit Money 3. Account statement");
}
}
class Account
{
int Accountno;
int pin;
float availableBalance;
float totalBalanace;
public void accdetails(int accno,int pin,float totalbal,float availbal)
{
this.Accountno=accno;
this.pin=pin;
this.totalBalanace=totalbal;
this.availableBalance=availbal;
}
}
abstract class Transaction
{
int TransactionId;
String TransactionDate;
}
class BankDatabase
{
}
class BalanceInquiry extends Transaction
{
float balance(Account acc)
{
return acc.availableBalance;
}
}
class Withdrawl extends Transaction
{
int amount;
public void withdraw(int amount,Account acc)
{
acc.availableBalance=acc.totalBalanace-amount;
}
}
class Deposit extends Transaction
{
}
public class ATM
{
public static void main(String aa[])
{
Screen screen=new Screen();
Keypad keypad=new Keypad();
screen.screen();
//int choice=keypad.input();
Account account=new Account();
Withdrawl withdraw=new Withdrawl();
BalanceInquiry balance=new BalanceInquiry();
account.accdetails(943333,1234,2000,1500);
int a=3;
while(a!=0)
{
a--;
switch(keypad.input())
{
case 1:System.out.println("Enter Amount to withdraw");
withdraw.withdraw(100,account);
break;
case 2: System.out.println("Enter Amount to deposit");
break;
case 3 : System.out.println("Display Account Summary");
float balan=balance.balance(account);
System.out.println("Available balance is:"+balan);
break;
}
}
}
}
O/P:
Welcome To ABC Bank
Enter your choioce
1. Withdraw Money
2.Deposit Money 3. Account statement
3
Display Account Summary
Available balance is:1500.0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.