Question: Can someone please write this code so I works correctly in java netbeans??? 1 Design/Write a class called BankAccount, as usual the class should have

Can someone please write this code so I works correctly in java netbeans???

1 Design/Write a class called BankAccount, as usual the class should have one or more constructors (at least one). The minimum attributes/properties of the class should be:

  • Account number
  • Account holder
  • Date created
  • Current Balance
  • Withdraw Limit

The account holder attribute should contain all the information for the person that owns the account. To implement this attribute you must use the Person class that we created during lectures (its posted to the course content section in Blackboard), you should build the Person class in a different project, and in order to use it you will have to add the jar file containing the Person class to your assignment 3 project and import it. Feel free to do some modifications to the Person class in order to better suit this assignment.

You must also implement proper get/set methods for every attribute in the class that requires it.

Other behaviors/methods that you should implement are:

  • A toString method that returns the current state of the class as a string.
  • A method that returns the account holders name.
  • A deposit money method that receives an amount of money as parameter and increases the current balance in the account by that amount.
  • A withdraw money method that receives an amount of money as parameter and decreases the current balance by that amount. This method should also return a boolean specifying if the operation was successful or not. For example, if the user tries to withdraw 100 dollars from the account when the current balance is 50 dollars the method should return false. Also if the user withdraws an amount of money bigger than the withdraw limit in the account, the method should return false. For example, If the withdraw limit in the account is 38, and the user calls

boolean success;

success = Account1.withdrawMoney(20);

success = Account1.withdrawMoney(10);

success = Account1.withdrawMoney(10);

The first two calls to withdrawMoney would return true and only the last one would return false.

2 Write an application that uses the BankAccount class created in part 1 (Place the class with the application code in the same package). The program should ask a user to enter their personal information, an initial amount of money, the date and a withdrawal limit and then create an account for that user. Then the program asks the user to perform an operation with the account that was just created. The user can perform one of these operations: DEPOSIT, WITHDRAW, BALANCE, or QUIT. If the user chooses BALANCE, the program should display the amount of money currently in the account. If the user chooses DEPOSIT or WITHDRAW, the program asks the user to enter an amount and then performs the operation. The program should keep accepting commands from the user until they type QUIT, then it will terminate. If the user types an invalid command the program should say Invalid Command, please try again. You can use the Scanner class to get the input from the user.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!