Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to Implement a PHP Class Containing 2 Methods?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 784
    Answer it

    Suppose that you have to implement a class named Dragonball. This class must have an attribute named ballCount (which starts from 0) and 2 methods iFoundaBall and iLostball. When iFoundaBall is called, ballCount is increased by one. When ilostball is called a a random number between 0 to ball count is chosen and subtracted from ball count. If the value of ballCount is equal to seven, then the message You can ask your wish is printed, and ballCount is reset to 0.


    How would you implement this class?

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: