1)      Write a bank account systemwith the following requirements: The bank class contains 4 methods(Set account, add to balance, withdraw, and showbalance) and a balance instance variable. The systemshould first ask the user to enter the initial amount to startwith, then it will ask him to choose what operation he wants toperform (ex: press 1 to add money, press 2 to withdraw money,press 3 to check balance, 0 to exit). The system should accept onlypositive numbers, and it should be dealing with a three decimalpoints floating numbers.

Sample output:

Welcome the your account

Please enter the amount you want to start with:

100.250

To add money, enter 1, to withdraw money, enter 2. To know yourbalance, enter 3. To exit, enter 0

1

Enter the positive amount you want to add:

50

To add money, enter 1, to withdraw money, enter 2. To know yourbalance, enter 3. To exit, enter 0

3

Your current balance is: 150.250

To add money, enter 1, to withdraw money, enter 2. To know yourbalance, enter 3. To exit, enter 0

2

Enter the positive amount you want to withdraw:

-70

You have entered a negative number

To add money, enter 1, to withdraw money, enter 2. To know yourbalance, enter 3. To exit, enter 0

3

Your current balance is: 150.250

To add money, enter 1, to withdraw money, enter 2. To know yourbalance, enter 3. To exit, enter 0

0

You chose to exit the system. Thank you.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *