Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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