//Part a (note, only certain parts will be needed for submit, don't just copypasta like crazy
public boolean equals( Object b )
{
if ( ! (b instanceof Employee) ) return false;
return getID().equals(((Employee)b).getID());
}
//Part b
public int compareTo( Employee b )
{
int t = lastName().compareTo(b.lastName()); if(t==0) { t = firstName().compareTo(b.firstName()); if(t==0) t=getID().compareTo(b.getID()); } return t;
}
//Part c
public boolean canViewMessage( Message m ) { if ( equals( m.from() ) ) return true;
for ( int i = 0 ; i < m.to().size() ; i++ ) if ( equals( m.to().get( i ) ) ) return true;
if ( managerStatus() < m.from().managerStatus() ) return false;
for ( int i = 0 ; i < m.to().size() ; i++ ) if ( managerStatus() >= m.to().get( i ).managerStatus() ) return true;
return false; }
//Problem 2
//Part a
public ArrayList<Server> needsAttention()
{
ArrayList<Server> broken = new ArrayList<Server>(); for(Server s : servers) { tif(!(s.ping())) broken.add(s); } return broken;
}
//Part b
public class Quad
{
private int[] ipComponents = new int[ 4 ];
public Quad( String ipAddress ) { String dot = "."; int a = 0; for(int j = 0; j < 4; j++) { tint b = a; twhile(b < ipAddress.length() && !dot.equals(ipAddress.substring(b, b+1))) b++; tipComponents[j] = Integer.parseInt(ipAddress.substring(a,b)); ta = b+1; } }
public String toString() { return ipComponents[ 0 ] + "." + ipComponents[ 1 ] + "." + ipComponents[ 2 ] + "." + ipComponents[ 3 ]; }
/* other methods not shown */
}
//Part c
public class Quad implements Comparable<Quad>
{
/* constructor, instance variable, and method from part (b) */
public boolean equals( Quad b ) { if ( !(b