Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the previous code from project 5 down written. .............................................................. package bank; //Customer class public class Customer { private String firstName; private String lastName; private String

the previous code from project 5 down written.

..............................................................

package bank;

//Customer class public class Customer { private String firstName; private String lastName; private String ssn;

//Constructor Customer(){ }

//setter and getter method public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getSsn() { return ssn; } public void setSsn(String ssn) { if((ssn.charAt(3) != '-')||(ssn.charAt(6) != '-')|| ssn.length()!=11) System.out.println("Invalid SSN."); else this.ssn = ssn; } }

///////////////////////////////

package bank;

//BankAccount class public abstract class BankAccount {

protected float balance; protected Customer customer; protected long accountNumber; public float getBalance() { return balance; }

public void setBalance(float balance) { this.balance = balance; }

public Customer getCustomer() { return customer; }

public void setCustomer(Customer customer) { this.customer = customer; }

public long getAccountNumber() { return accountNumber; }

public void setAccountNumber(long accountNumber) { this.accountNumber = accountNumber; }

//Constructors BankAccount (){ }

BankAccount(String firstName, String lastName, String ssn,float balance) { customer = new Customer(); customer.setFirstName(firstName); customer.setLastName(lastName); customer.setSsn(ssn); this.balance = balance; }

public void deposit(float amount) { balance = balance + amount; System.out.println(customer.getFirstName() + " " + customer.getLastName() + " deposited $" + amount + ". Current Balance $" + balance);

}

public void withdraw(float amount) { if (balance >= amount) { balance = balance - amount; System.out.println(customer.getFirstName() + " " + customer.getLastName() + " withdrew $" + amount + ". Current Balance $" + balance); } if (balance

}

//////////////////////

package bank;

//SavingAccount class public class SavingAccount extends BankAccount {

public SavingAccount() { }

public SavingAccount(String firstName, String lastName, String ssn, float balance) { super(firstName, lastName, ssn, balance); System.out.println("Successfully created account for " + firstName + " " + lastName + " " + accountNumber); System.out.println(firstName + " " + lastName + ", Balance $" + balance); }

public float applyInterest () { balance += ((balance - 10000) * 5)/100; return balance; }

long accountNumber() { long accountNumber = (long) Math.floor(Math.random() * 9000000000L) + 1000000000L; return accountNumber; }

float checkBalance() { System.out.println(customer.getFirstName() + " " + customer.getLastName() + ", Balance $" + balance); return balance; } }

/////////////////////////////

package bank;

//CheckingAccount class public class CheckingAccount extends BankAccount {

public CheckingAccount() { }

public CheckingAccount(String firstName, String lastName, String ssn, float balance) { super(firstName, lastName, ssn, balance); System.out.println("Successfully created account for " + firstName + " " + lastName + " " + accountNumber()); }

public float applyInterest () { balance += ((balance - 10000)*2)/100; return balance; }

float checkBalance() {

System.out.println(customer.getFirstName() + " " + customer.getLastName() + ", Balance $" + balance);

return balance; }

long accountNumber() { long accountNumber = (long) Math.floor(Math.random() * 9000000000L) + 1000000000L; return accountNumber; } }image text in transcribed

For this project you will start off by creatinga backup of project 5 oy and store project before making any changes to it. Then open project Sin Netbeans, right click on the project and rename the project to project For this project, you shall deneanew class Bani.Database The Dark Database contains the bank uniformation for a t duding saving s and their counts. The customer names are passed as the astrame Your action must set the string inte r esting for me and last name into the method you decide to s t ore the bank accoun ter will be made 100 ark in the Bank Database At You consideran Arinichae o w automatically as newbank accounts are added Bank Databaze dass implements the following methods Bank Dutabel-constructor void creat Cheding countring customer Series, ficat deposit - This method crestes achading account void creatSavingAccount Sering customer Seri f icat deposit - This method creates a sanga t void print - This method print the bonecountinformation in the database in ascending order of the account void applyintrest - This methods interest toalbank accounts. The interest for each type of account is the same Malce the following updates to the Bancourts.cerclass 1) Maire the Bank Account super class an abstract class and make applyinterest an abstract method 2. The Bank Account super class shal implement the Comparable Interface. You shall implement the compare To method to provide the means to sort the bank accounts in the ascending order of the account balance Identify the objects for this application and define cach lass attribute with proper access Qualiter. You can use the "main" method shown below to test your application. The expected output is also provided public class BankApp! public static void main(Stringlarsi BankDatabase actDatabase new BanicDatabasel: seet Database.createCheckingAccount Alin Parker", "12345-678920000.0 actDatabas.createSavingAccount Mary Jones, 987-65-4021, 15000.0: actDatabant.createSavingAccount John Smith, 123-45-678912000.00 setDatabase.print: at Database.plyinterest Database.printl Succesully created account for Ain Palerunt Number 5485736513 Succesfully created account for Mary Jonescunt Number 36-2979521 Succesfully created account for John Smith Account Number 6998050583 John Smith 993050822. Balance 5120000 Mary Jones, con 3612979521. Balance 150000 Alin Parler, 343573451. Balance 5200000 John Smith, acon 698050832, Balance 5125000 Mary Jones, con 3612979521. Balance 5157500 Alin Paris, en 542573518, Barce20200.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions