Question: Written in Java I need help with my errors so the code will run and I need this to be implemented into the code with

Written in Java I need help with my errors so the code will run

and I need this to be implemented into the code with comments throughtout

  1. Overload method PrintDate(),,,,When Location is null or empty, call the parents method PrintDate(), or else, print Location information and is not allowed to display printDate for clients"
  2. Create class of testClient
    1. build main method to test the classes you defined before,,,,,build an object of class PrintClient named pc, call the method PrintDate in PrintClient, set the value of field Location to Classroom",recall the method PrintDate

`import java.util.Date;

class Main

{

public static void main(String[] args)

{

// creating new PrintClient object pc

PrintClient pc = new PrintClient();

// calling method printDate in PrintClient

pc.printDate();

// setting value of field location to "Classroom"

pc.setLocation("Classroom");

// recalling method PrintDate

pc.printDate();

}

}

class Client

{

// private fields

private int ID;

private int port;

private String name;

// constructor first one

public Client()

{

}

// constructor second one

public Client(int id)

{

ID = id;

}

// constructor third one

public Client(int id, int p)

{

ID = id;

this.port = p;

}

// constructor fourth one

public Client(int id, int p, String n)

{

ID = id;

this.port = p;

this.name = n;

}

// getters and setters

public int getID()

{

return ID;

}

public void setID(int iD)

{

ID = iD;

}

public int getPort()

{

return port;

}

public void setPort(int port)

{

this.port = port;

}

public String getName()

{

return name;

}

public void setName(String name)

{

this.name = name;

}

public void printDate()

{

System.out.println("Print date of Client class");

}

}

// childrens class of contents

class PrintClient extends Client

{

// new field location

private String location;

// gets and sets

public String getLocation()

{

return location;

}

public void setLocation(String location)

{

this.location = location;

}

// printDate method

public void printDate()

{

Date d = new Date();

System.out.println(d.toString());

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!