Question: Please write as a Java console application. Thank you! i. Create a java class Client Member methods and variables private fields: 1. int ID, 2.
Please write as a Java console application. Thank you!
i. Create a java class Client Member methods and variables private fields:
1. int ID,
2. int port,
3. String Name
ii. Constructors:
(Reference https://www.w3schools.com/java/java_constructors.asp )
1. Client()
2. Client (int id)
3. Client (int id, int p)
4. Client (int id, int p, String n)
iii. public get/set methods to access private fields: (Reference https://www.w3schools.com/java/java_encapsulation.asp )
1. getPort()
2. setPort()
3. getID()
4. setID()
5. getName()
6. setName()
Public method to printout todays date: PrintDate() (Referencehttps://www.w3schools.com/java/java_date.asp )
Create Child class of Client PrintClient
add a field and get/set method to access it: String Location;
Overload method PrintDate() (Reference https://www.w3schools.com/java/ref_keyword_super.asp )
When Location is null or empty, call the parents method PrintDate(), or else, print Location information and print the message No date for this client.
Create class of testClient. Build a main method to test the classes you defined before
1. build an object of class PrintClient named pc
2. call the method PrintDate in PrintClient
3. set the value of field Location to Classroom
4. recall the method PrintDate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
