How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask LogicPro Your Own Question
LogicPro
LogicPro, Engineer
Category: Homework
Satisfied Customers: 12732
Experience:  Expert in Java C++ C C# VB Javascript Design SQL HTML
29751445
Type Your Homework Question Here...
LogicPro is online now
A new question is answered every 9 seconds

**For LOGICPRO only** Also, there is one more program

This answer was rated:

**For LOGICPRO only**

Also, there is one more program to write. It incorporates many of the concepts that were described throughout the course.

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 2 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, 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.
Download:
http://wikisend.com/download/312934/BankAccountExceptions.zip

You can ask me again using "For LogicPro only" at the start of your questions like you did to get instant answers.

It will ensure that question is for me.

Please bookmark my profile page:

http://www.justanswer.com/homework/expert-logicpro/

so you can come back and ask me a question anytime.

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and rate my answer as excellent. I can address follow up questions on original requirements at no extra charge and I’m always here to help.

Thank you for using this site!

Customer: replied 3 years ago.

Hi,


 


So far so good, although I'm not getting a statement balance that adds the interest to the current balance.


 


// post monthly interest by multiplying current balance
// by current interest rate divided by 12 and then adding
// result to balance by making deposit

dividing interest rate by 12, will give us monthly interest rate, and then add the result to the balance, since every month, monthly interest will be added to the balance.
Customer: replied 3 years ago.

ok this is the output:


 


Customer name: John Doe Balance: 1000.0
Interest Rate: 0.12


Posting Interest
Customer name: John Doe Balance: 1010.0
Interest Rate: 0.12
Enter deposit amount: 5
Customer name: John Doe Balance: 1015.0
Interest Rate: 0.12
Enter withdrawal amount: 4
Customer name: John Doe Balance: 1011.0
Interest Rate: 0.12


 


 


Can you show me where the program posts monthly interest by multiplying current balance by current interest rate divided by 12 and then adding result to balance by making a deposit? It should do this on its own..

THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.
LogicPro and other Homework Specialists are ready to help you
Customer: replied 3 years ago.

Ohhh ok. I see where it was added! Thank you. I will rate soon.

Welcome
Hi Carlos,
Just following up with you to see how everything is going and if you have more questions for me.
You can ask me again using "For LogicPro only" at the start of your questions like you do to get instant answers.
It will ensure that question is for me.
Please bookmark my profile page:
http://www.justanswer.com/homework/expert-logicpro/
so you can come back and ask me a question anytime.
If you need any additional information on this answer, please don't hesitate to ask by clicking on 'Reply to Expert', and I will reply as soon as possible.
I hope you found the information in my answer helpful, and if so, please let me know, here. Thank you!
Thanks very much for using Just Answer!
Best wishes
LogicPro

Related Homework Questions