Question: Write a php class that implements a bank account for deposits and withdrawals. This class will have data members representing name and balance. It will

 Write a php class that implements a bank account for deposits

Write a php class that implements a bank account for deposits and withdrawals. This class will have data members representing name and balance. It will also have a constructor that takes a name parameter and sets the name data member accordingly. Create functions for getbalance and getname. Create a function for deposit that will check if deposit amount is positive and if so add it to the account. Create a function for withdraw that will check if the withdraw amount is positive and if the it is less then the account balance and if so withdraw it. Lastly create a_ tostring method that will print out the account details when the object is used in an expression block. Create client code that includes this class. Create 2 bank account objects with it. Give the first account the name ica, deposit 5, withdraw 1.25, and withdraw 1000. Create a second account with the name tin, deposit 999 and deposit-15. Then display both accounts in a div in html

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 Databases Questions!