Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions