• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Trouble w/ Savings Acct Program

 
Stan Marsh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an assignment for a class and the prof has done a really poor job of helping out. I understand logic on java for the most part but just don't know how to achieve an end result; probably due to my lack of syntax understanding and inexperience. The criteria for this assignment is the paragraph or so following this message.. In the next post I will respond with what code I already have. I just don't know where to go from there

~~~~~~~~~~~~~~~~Assignment~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Create a base class called BankAccount with an instance variable of type double called balance,
an instance variable of type int called accountNumber, and
two instance variables of type String called firstName and lastName. The class should have an appropriate constructor to set all instance variables, and get and set methods for the instance variables. The set methods should verify that no invalid data is set. Define two concrete methods, Deposit which takes an amount and adds it to the balance and Withdrawal which takes an amount and subtracts it from the balance, and define one abstract method called CompoundMonthly.

Then define two derived classes CheckingAccount and SavingsAccount. CheckingAccount should contain a static variable of type double called monthlyFee, and SavingsAccount should contain a static variable of type double called interestRate. Both need an appropriate constructor and appropriate set methods for the static data.

Both subclasses also should override the method compoundMonthly, with the CheckingAccount subtracting the monthly fee and SavingsAccount adding the interest earned.
Write a test class which shows the user the following menu and implements all options. The program should continue to run and process requests until the user selects 12. The program should double-check that the user really wants to exit. You may use a limit of 10 possible accounts to simplify implementation. The program should assign new account numbers to assure their uniqueness. All input must be validated, and appropriate feedback given for invalid input. The accounts should not be allowed to become overdrawn.

1 – Enter a new checking account.
2 – Enter a new savings account.
3 – Delete individual account
4 – Deposit to individual account
5 – Withdrawal from individual account
6 – Compound individual account
7 – Compound all accounts
8 – Display individual account
9 – Display all accounts
10 – Set interest rate for savings accounts
11 – Set monthly fee for checking accounts
12 – Exit program

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Stan Marsh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is what i currently have.. I've only just gotten down to it.. but in the requirements it asks for constructors and i'm unclear on what they do and how to use them.

 
Campbell Ritchie
Sheriff
Posts: 48370
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Although your teacher uses inappropriate jargon (it's a superclass, not a base class,in Java), he has given you very specific instructions which you ought to follow closely. So you create a class called BankAccount, not BankAcct.
Don't start with a main method. Do what you have been told to do; you have been given a good order to do your tasks in. Work out whether you can instantiate each individual class.
You should find all about constructors in any of the standard textbooks (eg Deitel and Deitel), or (maybe a shorter account) in the Java™ Tutorials (try under "classes and objects").
 
Stan Marsh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! I'll keep posting code as I make progress...

It seems pretty straight forward.. If I hit a mental wall I will be sure to repost ASAP
 
Campbell Ritchie
Sheriff
Posts: 48370
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good luck with it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic