0% found this document useful (0 votes)
74 views14 pages

Simple Banking System in Java

This document describes a simple banking transaction program in Java. It allows users to sign up, login, and perform basic transactions like withdrawal, deposit, funds transfer, bill payment, changing pins, and logout. The program generates account numbers and allows one hardcoded user to login for demonstration purposes, but does not actually save transaction records or transfer funds between users.

Uploaded by

juencyzalty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views14 pages

Simple Banking System in Java

This document describes a simple banking transaction program in Java. It allows users to sign up, login, and perform basic transactions like withdrawal, deposit, funds transfer, bill payment, changing pins, and logout. The program generates account numbers and allows one hardcoded user to login for demonstration purposes, but does not actually save transaction records or transfer funds between users.

Uploaded by

juencyzalty
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DR. YANGA’S COLLEGES, INC.

Semi-Finals Project: Simple Banking Transaction in Java

SEMI-FINALS PROJECT:
SIMPLE BANKING TRANSACTION IN JAVA
______________________________________________

In partial fulfillment of the requirements for the course

Introduction to Programming in

Bachelor of Science in Information Technology

Presented by:

Dela Cruz, Franc Alvenn T.

October 23, 2022


DR. YANGA’S COLLEGES, INC. 2

Semi-Finals Project: Simple Banking Transaction in Java

CHAPTER I
INTRODUCTION

This project is a Simple Banking Transaction program in Java that is in compliance to the

requirements for the course Introduction to Programming. The main functions of the program

includes Logging in, Signing up, the basic transaction that a banking system has such as

withdrawal, deposit, transfer funds and paying bills, it also supports a change pin function with

logout to terminate the program.

It is to note that since this is an introductory course to coding and data basing is not yet

approve all signup information inputted (account name, account pin, account balance, and

account number) when the code is ran will not be saved. To ensure the login function works, a

hardcoded value for account name, account pin, account balance, and account number is provided

under the name “Admin”. It is also to note that transactions made during the code execution will

not be recorded thus making is impossible to show a transaction record for the banking system.

Transfer fund and Pay bills work but the transfer is not actually happening only the process of

deduction to the current balance takes place.

All the code provided here is in accordance to the given premises as such it does not

contain any classes or methods, only what was taught during the course is applied. Therefore, the

code is bit extensive and is repeating.


DR. YANGA’S COLLEGES, INC. 3

Semi-Finals Project: Simple Banking Transaction in Java

CHAPTER II

HOW THE CODE WORKS

The program first start by asking the user whether they are a new depositor or an existing

depositor. If the user is a new depositor he would first need to input all the necessary information

needed such as, account name, account pin, and initial balance after which the program would

then generate a six digit account number for the user to use when logging in. Once the user inputs

the correct login credentials he would then be redirected to the main interface of the banking

system which contains the multiple functions of the banking system. This includes withdrawal,

deposit, transfer funds, pay bills, change pin and logout.

On the withdrawal module, the user is asked to input the amount he would withdraw. If

the amount is greater than the account balance and greater than ten thousand the transaction

would terminate and the user would be redirected to the main interface. If the amount to be

withdrawn is within the parameters then the transaction would proceed and the amount

withdrawn is deducted to the balance of the user.

The deposit module would ask the user the amount he would deposit and add the amount

deposited to the balance of the user.

For the transfer fund, the user is asked to input the account number in which he would

like to transfer his funds as well as the amount. It is to note that the amount would be deducted

from the balance but the money transferred would not go anywhere since there are no other user

of the banking system aside from the current user.


DR. YANGA’S COLLEGES, INC. 4

Semi-Finals Project: Simple Banking Transaction in Java

For the pay bill function, the user is first asked which utility to pay for (e.g. electricity,

water, etc.) and the amount to pay. If the amount is greater than the account balance the

transaction would terminate and the user would be redirected to the main interface. It is to note

that this is a local program therefore it is not connected to any other system as such it is not

actually transferring the money only deducting the amount from the balance.

Change pin, is simply the user changing his current pin to another pin. While the logout

function is used when the user want to terminate the program else the program would simply

continue to loop.

Special Note:

Since this is already a continuing project the IPO, Pseudocode and Flowchart will not be

added here as it is in a separate file already submitted. Only the Java code is to be included with

in the Project proper.


DR. YANGA’S COLLEGES, INC. 5

Semi-Finals Project: Simple Banking Transaction in Java

CHAPTER II

THE JAVA CODE FOR THE PROGRAM

import [Link];
import [Link];

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/[Link] to change this
license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/[Link] to edit this template
*/

/**
*
* @author Administrator
*/
public class Simple_Banking_System {
public static void main(String[] args){

//Important Variables
boolean access = false;
String input;
boolean looper = true;
Random rand = new Random();
Scanner x = new Scanner([Link]);

//Banking User Information (Admin) initialized user;


String accountName = "Admin";
int PinNumber = 1111;
double Balance = 1_000_000;
int AccountNumber = 111111;

//Start of Simple Banking System


while (looper == true){
[Link]("Welcome to Simple Banking System!");
[Link]("Are you a new depositor or an existing depositor?");
[Link]("Type \"1\" for 'New Depositor' if you're a new depositor or");
[Link]("Type \"0\" for 'Existing Depositor' if you're an existing depositor");
[Link]("Input Here: ");
DR. YANGA’S COLLEGES, INC. 6

Semi-Finals Project: Simple Banking Transaction in Java

input = [Link]();
[Link]("------------------------------");

//New Depositor
// <editor-fold>
if ([Link]("1")) {
[Link]("Please fill the following:");
[Link]("Account Name: ");
accountName = [Link]();
[Link]("Pin Number: ");
PinNumber = [Link]();
[Link]("Initial Deposit Amount: ");
Balance = [Link]();
AccountNumber = [Link](100000,999999);
[Link]("You're Account has been made here is your Account Number: " +
AccountNumber);
[Link]("------------------------------");
// </editor-fold>

// Login
// <editor-fold>
while (access == false){
[Link]("Please enter the following:");
[Link]("Account Number: ");
int LoginNumber = [Link]();
[Link]("Pin Number: ");
int LoginPin = [Link]();
if(LoginNumber == AccountNumber && LoginPin == PinNumber){
[Link]("Login Succesful");
access = true;
}else{
[Link]("Wrong Account Number or Account Pin");
access =false;
}
}
// </editor-fold>

//Main Interface
// <editor-fold>
while(access == true){
[Link]("------------------------------");
[Link]("Welcome Back " + accountName);
[Link]();
[Link]("What would you like to do?");
[Link]("0 for Withdraw");
[Link]("1 for Deposit");
[Link]("2 for Pay Bills");
DR. YANGA’S COLLEGES, INC. 7

Semi-Finals Project: Simple Banking Transaction in Java

[Link]("3 for Transfer Funds");


[Link]("4 for Change Pin");
[Link]("5 for Logout");
[Link]("Input here: ");
int UI = [Link]();
[Link]("------------------------------");
switch (UI) {
case 0 -> { //Withdrawal Module
[Link]("------------------------------");
[Link]("Withdraw Amount: ");
double WA = [Link]();
if (WA < 10000 && WA < Balance) {
[Link]("Transaction Completed");
Balance -= WA;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
}
}
case 1 -> { // Deposit Module
[Link]("------------------------------");
[Link]("Deposit Amount: ");
double AD = [Link]();
Balance += AD;
[Link]("Balance: " + Balance);
}
case 2 -> { // Pay Bills Module
[Link]("------------------------------");
[Link]("Choose the Utility that you intend to pay for in the available
Categories");
[Link]("0 for Electricity");
[Link]("1 for Water Utilities");
[Link]("2 for Cable/Internet");
[Link]("3 for Loans");
[Link]("Input here: ");
int TBP = [Link]();
switch (TBP) {
case 0:
[Link]("------------------------------");
[Link]("Electricity");
[Link]("Amount to be Paid: ");
double AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
DR. YANGA’S COLLEGES, INC. 8

Semi-Finals Project: Simple Banking Transaction in Java

[Link]("Transaction Failed");
}
break;
case 1:
[Link]("------------------------------");
[Link]("Water Utilities");
[Link]("Amount to be Paid: ");
AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
} else {
[Link]("Transaction Failed");
}
break;
case 2:
[Link]("------------------------------");
[Link]("Cable/Internet");
[Link]("Amount to be Paid: ");
AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
}
break;
case 3:
[Link]("------------------------------");
[Link]("Loans");
[Link]("Amount to be Paid: ");
AP = [Link]();
[Link]("Processing ...");
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
[Link]();
}
break;
default:
[Link]("------------------------------");
[Link]("Invalid Input");
[Link]();
DR. YANGA’S COLLEGES, INC. 9

Semi-Finals Project: Simple Banking Transaction in Java

}
}
case 3 -> { // Transfer Funds
[Link]("------------------------------");
[Link]("Account Number: ");
int TA = [Link]();
[Link]("Amount to be transferred: ");
double AT = [Link]();
if (AT < Balance) {
[Link]("Transaction Complete");
Balance -= AT;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
[Link]();
}
}
case 4 -> { // Change Pin
[Link]("------------------------------");
[Link]("Please fill the following: ");
[Link]("Account Number: ");
int AN = [Link]();
[Link]("Old PIN Number: ");
int PIN = [Link]();
[Link]("New PIN: ");
int NPN = [Link]();
if (AN == AccountNumber && PIN == PinNumber) {
PinNumber = NPN;
[Link]("------------------------------");
[Link]("New Pin Number: " + PinNumber);
[Link]();
} else {
[Link]("------------------------------");
[Link]("Wrong Account Number and/or Pin Number");
[Link]();
}
}
case 5 -> { // Logout
[Link]("------------------------------");
[Link]("Are you sure you want to log out?");
[Link]("0 for NO");
[Link]("1 for YES");
[Link]("Input here: ");
int y = [Link]();
if (y == 0) {
access = true;
DR. YANGA’S COLLEGES, INC. 10

Semi-Finals Project: Simple Banking Transaction in Java

} else if (y == 1) {
[Link]("------------------------------");
[Link]("Thank you for using Simple Banking System");
[Link]("We hope to see you again. Goodbye!");
[Link]("------------------------------");
access = false;
looper = false;
}
}
default -> {
[Link]("Invalid Input");
[Link]("------------------------------");
}
}
}
// </editor-fold>

//Existing Depositor
// <editor-fold>
}else if([Link]("0")){
while (access == false){
[Link]("Please enter the following:");
[Link]("Account Number: ");
int LoginNumber = [Link]();
[Link]("Pin Number: ");
int LoginPin = [Link]();
if(LoginNumber == AccountNumber && LoginPin == PinNumber){
[Link]("Login Succesful");
access = true;
}else{
[Link]("Wrong Account Number or Account Pin");
access = false;
}
}
//Main Interface
// <editor-fold>
while(access == true){
[Link]("------------------------------");
[Link]("Welcome Back " + accountName);
[Link]();
[Link]("What would you like to do?");
[Link]("0 for Withdraw");
[Link]("1 for Deposit");
[Link]("2 for Pay Bills");
[Link]("3 for Transfer Funds");
[Link]("4 for Change Pin");
DR. YANGA’S COLLEGES, INC. 11

Semi-Finals Project: Simple Banking Transaction in Java

[Link]("5 for Logout");


[Link]("Input here: ");
int UI = [Link]();
[Link]("------------------------------");
switch (UI) {
case 0 -> { //Withdrawal Module
[Link]("------------------------------");
[Link]("Withdraw Amount: ");
double WA = [Link]();
if (WA < 10000 && WA < Balance) {
[Link]("Transaction Completed");
Balance -= WA;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
}
}
case 1 -> { // Deposit Module
[Link]("------------------------------");
[Link]("Deposit Amount: ");
double AD = [Link]();
Balance += AD;
[Link]("Balance: " + Balance);
}
case 2 -> { // Pay Bills Module
[Link]("------------------------------");
[Link]("Choose the Utility that you intend to pay for in the available
Categories");
[Link]("0 for Electricity");
[Link]("1 for Water Utilities");
[Link]("2 for Cable/Internet");
[Link]("3 for Loans");
[Link]("Input here: ");
int TBP = [Link]();
switch (TBP) {
case 0:
[Link]("------------------------------");
[Link]("Electricity");
[Link]("Amount to be Paid: ");
double AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
}
DR. YANGA’S COLLEGES, INC. 12

Semi-Finals Project: Simple Banking Transaction in Java

break;
case 1:
[Link]("------------------------------");
[Link]("Water Utilities");
[Link]("Amount to be Paid: ");
AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
} else {
[Link]("Transaction Failed");
}
break;
case 2:
[Link]("------------------------------");
[Link]("Cable/Internet");
[Link]("Amount to be Paid: ");
AP = [Link]();
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
}
break;
case 3:
[Link]("------------------------------");
[Link]("Loans");
[Link]("Amount to be Paid: ");
AP = [Link]();
[Link]("Processing ...");
if (AP < Balance) {
[Link]("Transaction Complete");
Balance -= AP;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
[Link]();
}
break;
default:
[Link]("------------------------------");
[Link]("Invalid Input");
[Link]();
}
}
DR. YANGA’S COLLEGES, INC. 13

Semi-Finals Project: Simple Banking Transaction in Java

case 3 -> { // Transfer Funds


[Link]("------------------------------");
[Link]("Account Number: ");
int TA = [Link]();
[Link]("Amount to be transferred: ");
double AT = [Link]();
if (AT < Balance) {
[Link]("Transaction Complete");
Balance -= AT;
[Link]("Balance: " + Balance);
} else {
[Link]("Transaction Failed");
[Link]();
}
}
case 4 -> { // Change Pin
[Link]("------------------------------");
[Link]("Please fill the following: ");
[Link]("Account Number: ");
int AN = [Link]();
[Link]("Old PIN Number: ");
int PIN = [Link]();
[Link]("New PIN: ");
int NPN = [Link]();
if (AN == AccountNumber && PIN == PinNumber) {
PinNumber = NPN;
[Link]("------------------------------");
[Link]("New Pin Number: " + PinNumber);
[Link]();
} else {
[Link]("------------------------------");
[Link]("Wrong Account Number and/or Pin Number");
[Link]();
}
}
case 5 -> { // Logout
[Link]("------------------------------");
[Link]("Are you sure you want to log out?");
[Link]("0 for NO");
[Link]("1 for YES");
[Link]("Input here: ");
int y = [Link]();
if (y == 0) {
access = true;

} else if (y == 1) {
[Link]("Thank you for using Simple Banking System");
DR. YANGA’S COLLEGES, INC. 14

Semi-Finals Project: Simple Banking Transaction in Java

[Link]("We hope to see you again. Goodbye!");


[Link]("------------------------------");
access = false;
looper = false;
}
}
default -> {
[Link]("Invalid Input");
[Link]("------------------------------");
}
}
}
// </editor-fold>
}else{
[Link]("Invalid Input");
}
}

// </editor-fold>
}
}

You might also like