SlideShare a Scribd company logo
Write a banking program that simulates the operation of your
local bank. You should declare the following collection of
classes. Class Account Data fields; customer (type Customer),
balance, accountNumber, transactions array (type Customer),
Transaction []). Allocate an initial Transaction array of a
reasonable size (e.g., 20), and provide a reallocate method that
doubles the size of the Transaction on array when it becomes
full. Methods: getBalance, getCustomer, toString, setCustomer
Class SavingsAccount extends Account Methods: deposit,
withdraw, addInterest Class CheckingAccount extends Account
Methods: deposit, withdraw, addInterest Class Customer Data
fields: name, address, age, telephoneNumber, customerNumber
Methods: Accessors and modifiers for data fields plus the
additional abstract methods getSavingsInterest.
getCheckInterest, and getCheckCharge. Classes Senior, Adult,
Student, all these classes extend Customer Each has constant
data fields SAVINGS_INTEREST. CHECK_INTEREST,
CHECK_CHARGE, good! and OVERDRAFT_PENALTY that
define these values for customers of that type, and each class
implements the corresponding accessors. Class Bank Data field:
accounts array (type Account []). Allocate an array of a
reasonable size e.g., 100), and provide a reallocate method.
Methods: addAccount, makeDeposit, make Withdrawal,
getAccount Class Transaction Data fields: customerNumber,
transactionType. amount, date, and fees (a string describing
unusual fees) Methods: processTran You need to write all these
classes and an application class that interacts with the user. In
the application, you should first open several accounts and then
enter several
Solution
Bank.java
/*
* 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 bankapplication;
import java.util.Scanner;
/**
*
* @author Shivakumar
*/
public class Bank {
Account[] account=new Account[100]; // array of type account
int count=0;
public void reallocate()
{
if(account[99]==null)
{
System.out.println("Not Full");
}
else
account=new Account[account.length*2];
}
public void addAccount() // mehtod to add an account
{
int age;
Scanner sc=new Scanner(System.in);
System.out.println("Enter the age of customer");
age=sc.nextInt();
System.out.println("Enter account type: s for savings c for
checkings");
if(sc.next().equals("s"))
account[count]=new SavingsAccount();
else if(sc.next().equals( "c"))
account[count]=new CheckingAccount();
if(age>60) // conditions to identify type of customer
{
System.out.println("accountnumber, age");
account[count].setCustomer(sc.next(),sc.nextInt(),new
Senior());
System.out.println("Enter name of customer");
account[count].customer.setName(sc.next());
System.out.println("Enter Address of customer ");
account[count].customer.setAddress(sc.next());
account[count].customer.setAge(age);
System.out.println("Enter number of customer");
account[count].customer.setCustomerNumber(sc.next());
System.out.println("Enter telephone number of customer ");
account[count].customer.setTelephoneNumber(sc.next());
}
if(age<60&& age>30)
{
System.out.println("accountnumber, age");
account[count].setCustomer(sc.next(),sc.nextInt(),new
Adult());
System.out.println("Enter name of customer");
account[count].customer.setName(sc.next());
System.out.println("Enter Address of customer ");
account[count].customer.setAddress(sc.next());
account[count].customer.setAge(age);
System.out.println("Enter number of customer");
account[count].customer.setCustomerNumber(sc.next());
System.out.println("Enter telephone number of customer ");
account[count].customer.setTelephoneNumber(sc.next());
}
else
{
System.out.println("accountnumber, age");
account[count].setCustomer(sc.next(),sc.nextInt(),new
Student()); // passing Student object
System.out.println("Enter name of customer");
account[count].customer.setName(sc.next());
System.out.println("Enter Address of customer");
account[count].customer.setAddress(sc.next());
account[count].customer.setAge(age);
System.out.println("Enter number of customer");
account[count].customer.setCustomerNumber(sc.next());
System.out.println("Enter telephone number of customer");
account[count].customer.setTelephoneNumber(sc.next());
}
}
public void makeDeposit()
{
}
public void makeWithdrawal()
{
}
public Account[] getAccount()
{
return account;
}
}
Customer.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public abstract class Customer {
/*
* 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.
*/
String name;
String Address;
String telephoneNumber;
String customerNumber;
int age;
public abstract float getSavingsInterest();
public abstract float getCheckInterest();
public abstract float getCheckCharge();
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
public void setAddress(String Address)
{
this.Address=Address;
}
public String getAddress()
{
return Address;
}
public void setTelephoneNumber(String telephoneNumber)
{
this.telephoneNumber=telephoneNumber;
}
public String getTelephoneNumber()
{
return telephoneNumber;
}
public void setCustomerNumber(String customerNumber)
{
this.customerNumber=customerNumber;
}
public String getCustomerNumber()
{
return customerNumber;
}
public void setAge(int age)
{
this.age=age;
}
public int getAge()
{
return age;
}
}
Savings Account.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class SavingsAccount extends Account {
float amount;
public void deposit(float amount)
{
balance=balance+amount;
}
public boolean withdraw(float amount)
{
if(balance<amount)
{
System.out.println("Do not have enough balance to
withdraw");
return true;
}
else
{
balance=balance-amount;
return false;
}
}
public void addInterest(float interest,int months)
{
amount=(balance*months*interest)/100*12;
balance=balance+amount;
}
}
CheckingAccount.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class CheckingAccount extends Account {
float amount;
public void deposit(float amount)
{
balance=balance+amount;
}
public boolean withdraw(float amount)
{
if(balance<amount)
{
System.out.println("Do not have enough balance to
withdraw");
return true;
}
else
{
balance=balance-amount;
return false;
}
}
public void addInterest(float interest,int months)
{
amount=(balance*months*interest)/100*12;
balance=balance+amount;
}
}
Senior.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class Senior extends Customer {
final float
SAVINGS_INTEREST=6,CHECK_INTEREST=7,CHECK_CHA
RGE=2,OVERDRAFT_PENALTY=1;
public float getCheckCharge()
{
return CHECK_CHARGE;
}
public float getSavingsInterest()
{
return SAVINGS_INTEREST;
}
public float getCheckInterest()
{
return CHECK_INTEREST;
}
}
Student.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class Student extends Customer {
final int
SAVINGS_INTEREST=4,CHECK_INTEREST=5,CHECK_CHA
RGE=3,OVERDRAFT_PENALTY=2;
public float getCheckCharge()
{
return CHECK_CHARGE;
}
public float getSavingsInterest()
{
return SAVINGS_INTEREST;
}
public float getCheckInterest()
{
return CHECK_INTEREST;
}
}
Adult.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class Adult extends Customer {
final int
SAVINGS_INTEREST=5,CHECK_INTEREST=6,CHECK_CHA
RGE=3,OVERDRAFT_PENALTY=2;
public float getCheckCharge()
{
return CHECK_CHARGE;
}
public float getSavingsInterest()
{
return SAVINGS_INTEREST;
}
public float getCheckInterest()
{
return CHECK_INTEREST;
}
}
Account.java
/*
* 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 bankapplication;
/**
*
* @author Shivakumar
*/
public class Account {
Customer customer;
float balance;
String accountNumber;
Transaction[] transactions=new Transaction[20];
public void reallocate()
{
if(transactions[19]!=null)
transactions=new Transaction[transactions.length*2];
else
System.out.println("Not full");
}
public float getBalance()
{
return balance;
}
public Customer getCustomer()
{
return customer;
}
public String toString()
{
return "balance: "+balance+" account Number:
"+accountNumber;
}
public void setCustomer(String accountNumber,float
balance,Customer customer)
{
this.accountNumber=accountNumber;
this.balance=balance;
this.customer=customer;
}
}
ProcessTran.java
/*
* 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 bankapplication;
import java.util.Date;
/**
*
* @author Shivakumar
*/
public class Transaction {
String customerNumber,transactionType;
float amount;
Date date;
String fees;
public void processTran()
{
}
}

More Related Content

Similar to Write a banking program that simulates the operation of your local ba.docx

C++ coding for Banking System program
C++ coding for Banking System programC++ coding for Banking System program
C++ coding for Banking System program
Harsh Solanki
 
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
hmaadi96
 
Congratulations!! You have been selected to create a banking simulat.docx
Congratulations!! You have been selected to create a banking simulat.docxCongratulations!! You have been selected to create a banking simulat.docx
Congratulations!! You have been selected to create a banking simulat.docx
breaksdayle
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
izabellejaeden956
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
ruthannemcmullen
 
End to-end machine learning project for beginners
End to-end machine learning project for beginnersEnd to-end machine learning project for beginners
End to-end machine learning project for beginners
Sharath Kumar
 
#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf
ANJANEYAINTERIOURGAL
 
The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdf
akshay1213
 
Apex enterprise patterns
Apex enterprise patternsApex enterprise patterns
Apex enterprise patterns
Amit Jain
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
Tareq Hasan
 
Marcus Matthews
Marcus MatthewsMarcus Matthews
Marcus Matthews
MarcusMatthews38
 
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docxsrcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
rafbolet0
 
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
sriram sarwan
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
Rajeev Sharan
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
anthonyfeliciano
 

Similar to Write a banking program that simulates the operation of your local ba.docx (15)

C++ coding for Banking System program
C++ coding for Banking System programC++ coding for Banking System program
C++ coding for Banking System program
 
https://uii.io/ref/hmaadi
https://uii.io/ref/hmaadihttps://uii.io/ref/hmaadi
https://uii.io/ref/hmaadi
 
Congratulations!! You have been selected to create a banking simulat.docx
Congratulations!! You have been selected to create a banking simulat.docxCongratulations!! You have been selected to create a banking simulat.docx
Congratulations!! You have been selected to create a banking simulat.docx
 
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdfBank Program in JavaBelow is my code(havent finished, but it be .pdf
Bank Program in JavaBelow is my code(havent finished, but it be .pdf
 
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docxCSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
CSC139 Chapter 9 Lab Assignments (1) Classes and Obj.docx
 
End to-end machine learning project for beginners
End to-end machine learning project for beginnersEnd to-end machine learning project for beginners
End to-end machine learning project for beginners
 
#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf#include iostream #include BankAccountClass.cpp #include .pdf
#include iostream #include BankAccountClass.cpp #include .pdf
 
The java class Account that simultes the Account class.pdf
   The java class Account that simultes  the Account class.pdf   The java class Account that simultes  the Account class.pdf
The java class Account that simultes the Account class.pdf
 
Apex enterprise patterns
Apex enterprise patternsApex enterprise patterns
Apex enterprise patterns
 
Java: Class Design Examples
Java: Class Design ExamplesJava: Class Design Examples
Java: Class Design Examples
 
Marcus Matthews
Marcus MatthewsMarcus Matthews
Marcus Matthews
 
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docxsrcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
srcCommissionCalculation.javasrcCommissionCalculation.javaimpo.docx
 
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
Cbsecomputersciencecclass12boardproject bankmanagmentsystem-180703065625-conv...
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
SQL Server 2008 Portfolio
SQL Server 2008 PortfolioSQL Server 2008 Portfolio
SQL Server 2008 Portfolio
 

More from ajoy21

Please complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docx
ajoy21
 
Please cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxPlease cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docx
ajoy21
 
Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docx
ajoy21
 
Please check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docx
ajoy21
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docx
ajoy21
 
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxPlease attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
ajoy21
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docx
ajoy21
 
Please answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxPlease answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docx
ajoy21
 
Please answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxPlease answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docx
ajoy21
 
Please answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxPlease answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docx
ajoy21
 
Please answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxPlease answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docx
ajoy21
 
Please answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxPlease answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docx
ajoy21
 
Please answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxPlease answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docx
ajoy21
 
Please answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxPlease answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docx
ajoy21
 
Please answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxPlease answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docx
ajoy21
 
Please answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxPlease answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docx
ajoy21
 
Please answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxPlease answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docx
ajoy21
 
Please answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxPlease answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docx
ajoy21
 
Please answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxPlease answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docx
ajoy21
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docx
ajoy21
 

More from ajoy21 (20)

Please complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docxPlease complete the assignment listed below.Define and explain, us.docx
Please complete the assignment listed below.Define and explain, us.docx
 
Please cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docxPlease cite sources for each question. Do not use the same sources f.docx
Please cite sources for each question. Do not use the same sources f.docx
 
Please choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docxPlease choose one of the following questions to answer for this week.docx
Please choose one of the following questions to answer for this week.docx
 
Please check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docxPlease check the attachment for my paper.Please add citations to a.docx
Please check the attachment for my paper.Please add citations to a.docx
 
Please answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docxPlease answer to this discussion post. No less than 150 words. Refer.docx
Please answer to this discussion post. No less than 150 words. Refer.docx
 
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docxPlease attach Non-nursing theorist summaries.JigsawExecutive .docx
Please attach Non-nursing theorist summaries.JigsawExecutive .docx
 
Please answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docxPlease answer the question .There is no work count. PLEASE NUMBER .docx
Please answer the question .There is no work count. PLEASE NUMBER .docx
 
Please answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docxPlease answer the following questions. Please cite your references..docx
Please answer the following questions. Please cite your references..docx
 
Please answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docxPlease answer the following questions.1.      1.  Are you or.docx
Please answer the following questions.1.      1.  Are you or.docx
 
Please answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docxPlease answer the following question with 200-300 words.Q. Discu.docx
Please answer the following question with 200-300 words.Q. Discu.docx
 
Please answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docxPlease answer the following question Why do you think the US ha.docx
Please answer the following question Why do you think the US ha.docx
 
Please answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docxPlease answer the following questions. Define tunneling in the V.docx
Please answer the following questions. Define tunneling in the V.docx
 
Please answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docxPlease answer the following questions1. How can you stimulate the.docx
Please answer the following questions1. How can you stimulate the.docx
 
Please answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docxPlease answer the following questions very deeply and presicely .docx
Please answer the following questions very deeply and presicely .docx
 
Please answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docxPlease answer the following questions in an informal 1 ½ - 2-page es.docx
Please answer the following questions in an informal 1 ½ - 2-page es.docx
 
Please answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docxPlease answer the following questions in a response of 150 to 200 wo.docx
Please answer the following questions in a response of 150 to 200 wo.docx
 
Please answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docxPlease answer these questions regarding the (TILA) Truth in Lending .docx
Please answer these questions regarding the (TILA) Truth in Lending .docx
 
Please answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docxPlease answer the following question pertaining to psychology. Inc.docx
Please answer the following question pertaining to psychology. Inc.docx
 
Please answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docxPlease answer the following questions in a response of 250 to 300 .docx
Please answer the following questions in a response of 250 to 300 .docx
 
Please answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docxPlease answer the three questions completly. I have attached the que.docx
Please answer the three questions completly. I have attached the que.docx
 

Recently uploaded

Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
TechSoup
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
Nguyen Thanh Tu Collection
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
ImMuslim
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 

Recently uploaded (20)

Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
Elevate Your Nonprofit's Online Presence_ A Guide to Effective SEO Strategies...
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 8 - CẢ NĂM - FRIENDS PLUS - NĂM HỌC 2023-2024 (B...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
Geography as a Discipline Chapter 1 __ Class 11 Geography NCERT _ Class Notes...
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 

Write a banking program that simulates the operation of your local ba.docx

  • 1. Write a banking program that simulates the operation of your local bank. You should declare the following collection of classes. Class Account Data fields; customer (type Customer), balance, accountNumber, transactions array (type Customer), Transaction []). Allocate an initial Transaction array of a reasonable size (e.g., 20), and provide a reallocate method that doubles the size of the Transaction on array when it becomes full. Methods: getBalance, getCustomer, toString, setCustomer Class SavingsAccount extends Account Methods: deposit, withdraw, addInterest Class CheckingAccount extends Account Methods: deposit, withdraw, addInterest Class Customer Data fields: name, address, age, telephoneNumber, customerNumber Methods: Accessors and modifiers for data fields plus the additional abstract methods getSavingsInterest. getCheckInterest, and getCheckCharge. Classes Senior, Adult, Student, all these classes extend Customer Each has constant data fields SAVINGS_INTEREST. CHECK_INTEREST, CHECK_CHARGE, good! and OVERDRAFT_PENALTY that define these values for customers of that type, and each class implements the corresponding accessors. Class Bank Data field: accounts array (type Account []). Allocate an array of a reasonable size e.g., 100), and provide a reallocate method. Methods: addAccount, makeDeposit, make Withdrawal, getAccount Class Transaction Data fields: customerNumber, transactionType. amount, date, and fees (a string describing unusual fees) Methods: processTran You need to write all these classes and an application class that interacts with the user. In the application, you should first open several accounts and then enter several Solution
  • 2. Bank.java /* * 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 bankapplication; import java.util.Scanner; /** * * @author Shivakumar */ public class Bank { Account[] account=new Account[100]; // array of type account int count=0; public void reallocate() { if(account[99]==null) { System.out.println("Not Full"); } else account=new Account[account.length*2];
  • 3. } public void addAccount() // mehtod to add an account { int age; Scanner sc=new Scanner(System.in); System.out.println("Enter the age of customer"); age=sc.nextInt(); System.out.println("Enter account type: s for savings c for checkings"); if(sc.next().equals("s")) account[count]=new SavingsAccount(); else if(sc.next().equals( "c")) account[count]=new CheckingAccount(); if(age>60) // conditions to identify type of customer { System.out.println("accountnumber, age"); account[count].setCustomer(sc.next(),sc.nextInt(),new Senior()); System.out.println("Enter name of customer"); account[count].customer.setName(sc.next()); System.out.println("Enter Address of customer "); account[count].customer.setAddress(sc.next()); account[count].customer.setAge(age); System.out.println("Enter number of customer");
  • 4. account[count].customer.setCustomerNumber(sc.next()); System.out.println("Enter telephone number of customer "); account[count].customer.setTelephoneNumber(sc.next()); } if(age<60&& age>30) { System.out.println("accountnumber, age"); account[count].setCustomer(sc.next(),sc.nextInt(),new Adult()); System.out.println("Enter name of customer"); account[count].customer.setName(sc.next()); System.out.println("Enter Address of customer "); account[count].customer.setAddress(sc.next()); account[count].customer.setAge(age); System.out.println("Enter number of customer"); account[count].customer.setCustomerNumber(sc.next()); System.out.println("Enter telephone number of customer "); account[count].customer.setTelephoneNumber(sc.next()); } else { System.out.println("accountnumber, age"); account[count].setCustomer(sc.next(),sc.nextInt(),new Student()); // passing Student object System.out.println("Enter name of customer");
  • 5. account[count].customer.setName(sc.next()); System.out.println("Enter Address of customer"); account[count].customer.setAddress(sc.next()); account[count].customer.setAge(age); System.out.println("Enter number of customer"); account[count].customer.setCustomerNumber(sc.next()); System.out.println("Enter telephone number of customer"); account[count].customer.setTelephoneNumber(sc.next()); } } public void makeDeposit() { } public void makeWithdrawal() { } public Account[] getAccount() { return account; } } Customer.java
  • 6. /* * 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 bankapplication; /** * * @author Shivakumar */ public abstract class Customer { /* * 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. */ String name; String Address; String telephoneNumber; String customerNumber; int age; public abstract float getSavingsInterest(); public abstract float getCheckInterest();
  • 7. public abstract float getCheckCharge(); public void setName(String name) { this.name=name; } public String getName() { return name; } public void setAddress(String Address) { this.Address=Address; } public String getAddress() { return Address; } public void setTelephoneNumber(String telephoneNumber) { this.telephoneNumber=telephoneNumber; } public String getTelephoneNumber() { return telephoneNumber; }
  • 8. public void setCustomerNumber(String customerNumber) { this.customerNumber=customerNumber; } public String getCustomerNumber() { return customerNumber; } public void setAge(int age) { this.age=age; } public int getAge() { return age; } } Savings Account.java /* * 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 bankapplication;
  • 9. /** * * @author Shivakumar */ public class SavingsAccount extends Account { float amount; public void deposit(float amount) { balance=balance+amount; } public boolean withdraw(float amount) { if(balance<amount) { System.out.println("Do not have enough balance to withdraw"); return true; } else { balance=balance-amount; return false; } } public void addInterest(float interest,int months)
  • 10. { amount=(balance*months*interest)/100*12; balance=balance+amount; } } CheckingAccount.java /* * 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 bankapplication; /** * * @author Shivakumar */ public class CheckingAccount extends Account { float amount; public void deposit(float amount) { balance=balance+amount;
  • 11. } public boolean withdraw(float amount) { if(balance<amount) { System.out.println("Do not have enough balance to withdraw"); return true; } else { balance=balance-amount; return false; } } public void addInterest(float interest,int months) { amount=(balance*months*interest)/100*12; balance=balance+amount; } } Senior.java /* * To change this license header, choose License Headers in
  • 12. Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package bankapplication; /** * * @author Shivakumar */ public class Senior extends Customer { final float SAVINGS_INTEREST=6,CHECK_INTEREST=7,CHECK_CHA RGE=2,OVERDRAFT_PENALTY=1; public float getCheckCharge() { return CHECK_CHARGE; } public float getSavingsInterest() { return SAVINGS_INTEREST; } public float getCheckInterest() { return CHECK_INTEREST; }
  • 13. } Student.java /* * 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 bankapplication; /** * * @author Shivakumar */ public class Student extends Customer { final int SAVINGS_INTEREST=4,CHECK_INTEREST=5,CHECK_CHA RGE=3,OVERDRAFT_PENALTY=2; public float getCheckCharge() { return CHECK_CHARGE; } public float getSavingsInterest() { return SAVINGS_INTEREST; }
  • 14. public float getCheckInterest() { return CHECK_INTEREST; } } Adult.java /* * 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 bankapplication; /** * * @author Shivakumar */ public class Adult extends Customer { final int SAVINGS_INTEREST=5,CHECK_INTEREST=6,CHECK_CHA RGE=3,OVERDRAFT_PENALTY=2; public float getCheckCharge() { return CHECK_CHARGE; }
  • 15. public float getSavingsInterest() { return SAVINGS_INTEREST; } public float getCheckInterest() { return CHECK_INTEREST; } } Account.java /* * 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 bankapplication; /** * * @author Shivakumar */ public class Account { Customer customer; float balance;
  • 16. String accountNumber; Transaction[] transactions=new Transaction[20]; public void reallocate() { if(transactions[19]!=null) transactions=new Transaction[transactions.length*2]; else System.out.println("Not full"); } public float getBalance() { return balance; } public Customer getCustomer() { return customer; } public String toString() { return "balance: "+balance+" account Number: "+accountNumber; } public void setCustomer(String accountNumber,float balance,Customer customer) {
  • 17. this.accountNumber=accountNumber; this.balance=balance; this.customer=customer; } } ProcessTran.java /* * 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 bankapplication; import java.util.Date; /** * * @author Shivakumar */ public class Transaction { String customerNumber,transactionType; float amount; Date date; String fees;