Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 system

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

=+8. How free does this public see itself to act on this issue?

Answered: 1 week ago