Ask Question
29 April, 03:13

All phones must have a way of making and then terminating a connection to the phone network; however the exact procedure for doing so depends upon the nature of the phone (e. g. landline, cell phone, satellite phone). Write a abstract class, Phone, that contains a string instance variable, phoneNumber, a constructor that accepts a string parameter initializing the instance variable, an accessor method, getPhoneNumber, that returns the phoneNumber, a toString method that return the phoneNumber in the form # (phoneNumber), and two abstract methods: a boolean-valued method named createConnection that returns a boolean and accepts an reference to an object of type Network, and a void-returning method, closeConnection, that accepts no parameters

+2
Answers (1)
  1. 29 April, 05:27
    0
    Java class is given below

    Explanation:

    public abstract class Phone

    {private

    String phoneNumber;

    public Phone (String phoneNumber)

    {

    this. phoneNumber = phoneNumber;

    }

    public String getPhoneNumber ()

    {

    return this. phoneNumber;

    }

    public String toString ()

    {

    return "# ("+this. phoneNumber+") ";

    }

    public abstract boolean createConnection (Network n);

    public abstract void closeConnection ();

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “All phones must have a way of making and then terminating a connection to the phone network; however the exact procedure for doing so ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers