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

  Question related to business intelligencethe purpose of

question related to business intelligencethe purpose of this activity is to investigate a peer-reviewed academic

  Hr functions contribute to effective organizationsexplain

hr functions contribute to effective organizationsexplain what are some hr functions that contribute to creating a high

  Regression analysis is a powerful and commonly used tool

Regression analysis is a powerful and commonly used tool in business research. One important step in regression is to determine the dependent and independent variable(s).In a bivariate regression, which variable is the dependent variable and whi..

  Explain how about to discuss unionizing

Explain how about to discuss unionizing? If not, illustrate what types of restrictions should industries be allowed to place on the use of their e-mail systems?

  Elements that influence consumers decision-makingwhat are

elements that influence consumers decision-makingwhat are the elements that influence consumers decision-making and

  Explore strategies to overcome the threats

Your paper must comprise a reference list. All research should be cited in the body of the paper. In-text citations also corresponding references should be comprised in your paper. Explore strategies to overcome the threats also capitalize on oppor..

  Advantages associated with ethical decision making

Describe the advantages associated with ethical decision making.

  Various ways affirmative action occurs within a workforce

Discuss the various ways affirmative action occurs within a workforce?

  Explain depreciation is an example of a source of financial

Explain Depreciation is an example of a source of financial leverage and A firm with a high level of operating leverage must also have a high level of financial leverage.

  The lower-cost housing

If the economists' argument is correct that rent controls do more harm than good, why have rent controls existed in so many U.S. cities? Discuss who directly benefits from instituting and maintaining rent controls besides the renters who occupy the l..

  Illustrate what purpose does structure serve

Important variables to consider when creating managerial structure (span of management, centralization, etc -.) Illustrate what purpose does structure serve.

  Example of business strategy

Evaluate whether or not the business strategy is dictated by the industry or type of business. Provide an example of an industry and your rationale.

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