Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 12 Weeks Ago, 1 Day Ago |
Questions Answered: | 4870 |
Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I'm having trouble with this piece of code for a programming exercise. Â Here is the exercise description:Â
Assume the existence of an interface, CommDevice, with the followingmethods :
Define aclass , Firewall, that implements the above interface, and has the following members:
 public Firewall(String receiver){
      permittedReceiver = receiver;
   }
Â
   public void transmit(String first, String second){
      destination = first;
      buffer = second;
      System.out.println("Data scheduled for transmission to " + destination);
   }
Â
   public boolean receive(String first, String second){
      if(first == permittedReceiver){
         buffer = second;
         return true;
      }else{
         buffer = "";
         System.out.print ("Attempted breach of firewall by " + first);
         return false;
      }
   }
}
-----------