Answered step by step
Verified Expert Solution
Question
1 Approved Answer
solve for this java problem Create a Banking System, where a user can create new account, deposit money, withdraw money and check the balance of
solve for this java problem
Create a Banking System, where a user can create new account, deposit money, withdraw money and check the balance of his/her account. What you need to do: 1) Create a BankAccount class which has 3 instance variables; name, accNum and balance. a. Create a constructor with 3 arguments and initialize the attributes. The class also has the following 4 methods; b. void deposit(double depAmount) - Inside the method the balance variable needs to be increased by the "depAmount" amount. c. void withdraw(double withAmount) - The balance is decreased by "withAmount" amount. We have to make sure the balance does not become negative. d. double getBalance() - The method returns the balance. e. void display() - This method displays the attributes in the format "Name:[name]; AccNum:[accNum]; Balance:[balance]". Use toString() method to get the formatted string. 2) Now create an application class (that has the main method) named "Bank" which will have the main method. - In the main method, you need to create an account first. So, take input for the 3 fields (name, accNum, balance) from the user. After taking the input, create a BankAccount object. After creating the account, you have to provide a menu on the console. It will take user input to decide what action to take. - Input ' 1 ' means deposit money. For this input, you have to ask user for the amount of money he wants to deposit. - Input '2' means withdraw money. So, you have to ask user for the amount of money he wants to withdraw. Also you need to prompt if he needs to know the balance. If yes, you need to display the balance before the withdrawal and after the withdrawal. - Input ' 3 ' means display the balance of the account. In that case you have to display the balance. - Input ' 0 ' means exit the systemStep by Step Solution
There are 3 Steps involved in it
Step: 1
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