Create a class called bank account

Assignment Help Business Management
Reference no: EM13764476

Bank Account Program

Create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two constructors, as follows:

public BankAccount(String name, double balance)

throws NegativeAmountException

{

// set name and balance

// make sure balance is not negative

// throw exception if balance is negative

}

public BankAccount(String name)

throws NegativeAmountException

{

// set name and use 0 balance

}
As can be seen, the first constructor throws a NegativeAmountException if the balance being used to create the bank account is negative. You will have to create this exception class yourself.
The BankAccount class should also contain methods to make a deposit, make a withdrawal, get the current balance, and print a bank account statement. The interfaces for these methods should appear as follows:
// update balance by adding deposit amount

// make sure deposit amount is not negative

// throw exception if deposit is negative

public void deposit(double amount) throws NegativeAmountException

// update balance by subtracting withdrawal amount

// throw exception if funds are not sufficient

// make sure withdrawal amount is not negative

// throw NegativeAmountException if amount is negative

// throw InsufficientFundsException if balance < amount

public void withdraw(double amount)

throws InsufficientFundsException, NegativeAmountException

// return current balance

public double getBalance()

// print bank statement including customer name

// and current account balance

public void printStatement();
Use the BankAccount class as the superclass for a SavingsAccount class. In addition to the behaviors of a BankAccount, a SavingsAccount also accumulates interest; therefore, the SavingsAccount class contains a double that is populated with the current interest rate. In addition to its constructors (you decide what the constructors should be), the SavingsAccount class should contain the following methods:
// post monthly interest by multiplying current balance

// by current interest rate divided by 12 and then adding

// result to balance by making deposit

public void postInterest()

// print bank statement including customer name

// and current account balance (use printStatement from

// the BankAccount superclass)

// following this also print current interest rate

public void printStatement()
Once these two classes are completed, create a driver class called FinalExam containing a main method that tests the SavingsAccount class. Within the driver test class, create a SavingsAccount object and then use it to make deposits and withdrawals, and to post the monthly interest.
To make the program simpler, you can incorporate the initial data for the Savings Accounts directly in the program (e.g., no need to prompt for the account holder name or starting balance). The only things you need to prompt for are the deposit amount and the withdrawal amount. Also, to simplify the task, the only exceptions that you should handle are the NegativeAmountException and the InsufficientFundsException. If either of these exception conditions occurs, print an appropriate error message and terminate the application. You can simply re-throw any IOExceptions from the main.

Reference no: EM13764476

Questions Cloud

Criminal fraud versus civil fraud and taxation : Imagine a situation in which a client under audit by the IRS omitted $100,000 in income. From the e-Activity, examine the major factors relative to the omission by the client that would result in a criminal investigation, rather than a civil fraud..
Explain the decrease in criminal activity for young people : Your individual work assignment is to research and explain the decrease in criminal activity for young people after they pass through a period of adolescence
Sustainable approach to waste reduction developed : Analyze the sustainable approach to waste reduction developed - Previous methods of production
Compute the optimal order quantity using the eoq model : Compute the optimal order quantity using the EOQ model. Compute a) the number of orders per year and b) the annual relevant total cost of ordering and carrying inventory.
Create a class called bank account : Create a class called BankAccount. The BankAccount class should contain a String to store the customer name and a double to store the account balance. The BankAccount class should have two constructors, as follows:
Problem related to the contractual remedies : Haply Inc. contracts with Barksdale LLC to have an engine repaired. After much negotiation, the parties agree that the pump will be repaired and reinstalled at Haply's facilities in 5 days. Haply plans on losing $40,000 a day for each day the engi..
Water quality and contamination : Discuss the value of statistical significance vs. pragmatic usefulness.
Database development : Recommend at least three (3) specific tasks that could be performed to improve the quality of datasets, using the Software Development Life Cycle (SDLC) methodology. Include a thorough description of each activity per each phase.
Costs and revenues for the new product : Oakmont Company has an opportunity to manufacture and sell a new product for a four-year period. The company's discount rate is 16%. After careful study, Oakmont estimated the following costs and revenues for the new product:

Reviews

Write a Review

Business Management Questions & Answers

  Explain this allowed them to survive until they were rescued

Explain This allowed them to survive until they were rescued and After they were rescued they were charged with premeditated first degree murder under the relevant state statute

  Post addresses the multi-generational workforcethere are

post addresses the multi-generational workforce.there are now at least four generations in the workplace at one time.

  Team development stages

Imagine that you are manager of a team that collaborates on several projects. These assignment requires to be addressed by the entire group to provide resolutions that are in the firm's best interest since it will affect all parties and sections.

  Explain and conduct the decision making process

Explain and Conduct and present research that evaluates the decision making process within the organization

  Explain how are the components of international strategy

Illustrate what are the differences between a majority opinion and a dissenting opinion in terms of an actual case law and policy impact? Explain how are the components of international strategy.

  Explaining franchisee versus the cost of being a franchisee

What's the balance in corporate support from being a franchisee versus the cost of being a franchisee?

  Question about sustain values

Discuss how are we as managers to maintain and sustain values over time in light of  mergers, acquisitions, rapid change, turnover, etc..

  Products or services to the u.s. government

your company is selling its products or services to the U.S. government

  How to apply knowledge of organizations to organization

In this essay, you will apply the knowledge of organizations to organization, group or situation of choice using Bolman & Deal 2008.

  Discuss the political risk management

Should political risk management be an active strategy?

  What is the foundation of ecuador''s comparative advantage

What is the foundation of Ecuador's comparative advantage in the production of roses? Most Ecuadorean roses are traded in the United States or Europe

  Decisive influences on strategy formulation

Decisive Influences on Strategy Formulation

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd