Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class JavaAccount { private String customerName; private long AccountNumber; private double balance; private double interestRate; JavaAccount(String customerName,long AccountNumber,double balance,double interestRate){ this.customerName=customerName; this.AccountNumber=AccountNumber; this.balance=balance; this.interestRate=interestRate;

public class JavaAccount { private String customerName; private long AccountNumber; private double balance; private double interestRate; JavaAccount(String customerName,long AccountNumber,double balance,double interestRate){ this.customerName=customerName; this.AccountNumber=AccountNumber; this.balance=balance; this.interestRate=interestRate; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public long getAccountNumber() { return AccountNumber; } public void setAccountNumber(long accountNumber) { AccountNumber = accountNumber; } public double getBalance() { return balance; } public void setBalance(double d) { this.balance = d; } public double getInterestRate() { return interestRate; } public void setInterestRate(double d) { this.interestRate = d; } public void deposit(double amount){ this.setBalance(this.getBalance()+amount); System.out.println("Deposit Successful"); System.out.println("New Amount:"+this.getBalance()); return; } public void withdraw(double amount){ this.setBalance(this.getBalance()-amount); System.out.println("Withdrawl Successful"); System.out.println("New Amount:"+this.getBalance()); return; } public void checkBalance(){ System.out.println("Balance:"+getBalance()); } }

(a) When you extends the javaAccount.java, you will need to override the super() constructors. (b) Add a static field called "minimumBalanceRequired" such that when account balance meets the minimumBalanceRequired, you get unlimited checking without fees. Otherwise, regular checking fees will apply. // hint: inside the withdraw() method, deduct a fee whenever the balance is below the minimum. (c) Add a static method to reset minimumBalanceRequired. (d) Add a new data fields called PIN# such that an internal PIN# has to match the input parameters before any transactions. Re-write the following methods with a PIN#: checkBalance(); deposit(), withdraw() and so on. (e) Add an implementation of the .toString() method to override any default methods: The toString() methods returns the premium account information #2. Add implementation of exception handling to the PremiumAccount.java class. (a) Inside each method with a PIN# input parameter, throw a appropriate exception object of your choice. (b) (OPTIONAL) Implement a new exception mechanism that allows only 3 consecutive trials of invalid PINs.

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

Step: 3

blur-text-image

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

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions