This repository contains a Java program that simulates a basic ATM system. The program includes classes for creating savings and checking accounts, performing deposits, withdrawals, and checking account balances. The purpose of this project is to provide a simple example of object-oriented programming in Java.
-
bankaccount
(Abstract Class):- Abstract class representing a generic bank account.
- Contains attributes like
accountno
,accountholdername
, andbalance
. - Abstract methods
deposit
andwithdraw
to be implemented by subclasses.
-
savingaccount
(Class extendingbankaccount
):- Represents a savings account.
- Inherits from
bankaccount
and implements the abstract methods. - Has an additional attribute
interestrate
and overrides thewithdraw
method.
-
checkingaccount
(Class extendingbankaccount
):- Represents a checking account.
- Inherits from
bankaccount
and implements the abstract methods. - Has an additional attribute
overdraftlimit
and overrides thewithdraw
method.
-
atmtransaction
(Interface):- An interface defining methods for ATM transactions -
withdraw
,deposit
, andcheckbalance
.
- An interface defining methods for ATM transactions -
-
atm
(Class implementingatmtransaction
):- Represents the ATM system.
- Implements methods for account management, withdrawal, deposit, and checking balance.
- Maintains an
ArrayList
ofbankaccount
objects.
-
ATMmain
(Main Class):- Contains the
main
method to execute the ATM program. - Creates an instance of the
atm
class and initializes sample saving and checking accounts. - Provides a user interface for creating accounts and performing transactions.
- Contains the
-
Creating Accounts:
- Choose between saving and checking accounts.
- Enter account holder's name.
-
Managing Accounts:
- Deposit funds into an account.
- Withdraw funds from an account.
- Check the account balance.
-
ATM Operation:
- The ATM class provides a text-based menu for users to interact with their accounts.
-
Error Handling:
- The program includes basic error handling for invalid inputs.
-
Compile:
- Compile the Java program using a Java compiler.
-
Run:
- Run the compiled program.
-
Follow On-Screen Instructions:
- Interact with the program by following the on-screen instructions.
- The program uses a simple random number generator to assign account numbers.
- It includes a basic exception handling mechanism for unexpected input.
This program is a simplified simulation for educational purposes and may not represent real-world banking systems. Use it at your own risk.
This project is licensed under the MIT License. Feel free to use, modify, and distribute the code.