Question
Develop the two java programs in the Net Beans or Eclipse environment. Then compress your projects in two different zip files. Create a MS Word
Develop the two java programs in the Net Beans or Eclipse environment. Then compress your projects in two different zip files. Create a MS Word document and copy and paste the code and the result of the run.
Generate an Application (BankApp) that performs the following activities:
Request the name of the Account Owner (String) and Balance (double) using Scanner.
The Application must create and 2 instances of the class BankAccount: the first instance will pass the Owner name and Balance the constructor. The second instance will pass only the name.
In order to test the second instance you will have to set your balance using the SetBalance method.
The App must invoke the 2 methods (WithDraw and Deposit) from the BankAccount.
The Application must print out the Owner name, previous balance, and current balance after a withdraw, and a deposit. In order to get Owner name and Balance the Application must invoked the GetName and GetBalance method from the BankAccount class.
The class BankAccount must have the following requirement:
The class must have 2 have 2 private class variables: name (String) and balance (double).
The class will have 2 constructors: The first constructor won't let the user enter only the name of the account owner name (String). the constructor will allow the Application to pass 2 values: the Account owner name (String) and the Balance (double).
You need to develop a method Withdraw with the following: It won't return anything and it will receive as a parameter the amount to withdraw from the balance. The method must check the balance if there not enough balance a message must be send (using the JOptionPane showMessageDialog) and not withdraw should be performed, otherwise the method perform the withdraw.
You need to develop a method Deposit with the following: It won't return anything and it will receive as a parameter the amount to deposit to the balance. The method Deposit shouldn't let the use deposit over 1,000 dollars. If the user try to deposit 1,000 dollars a message must be send and not deposit should be performed, otherwise the method perform the deposit and send a message using the JOptionPane showMessageDialog.
Develop the method SetBalance to add balance when using the constructor with only name as parameter. GetName and GetBalance to retrieve name and Balance values from BankAccount class. Don't forget both methods should return data (String for the name and double for the balance). These methods won't receive any parameter.
Part 2: Instead to use Scanner for the data collection you must use JOptionPane ShowInputDialog.
Step by Step Solution
3.47 Rating (144 Votes )
There are 3 Steps involved in it
Step: 1
here is the code which will help you to develop be excueting the code you needed to intall the JDK s...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started