Define a class based on the UML class diagram according to your NSU ID. Choose NewDate if your middle four digits of your NSU ID is odd, otherwise choose NewTime. The first constructor initialized with today's date or current time. The second constructor initialized the object with the given string. The separator of the elements may be r,“ or:. Use split method of String class. The third constructor extract Date or Time elements from the given Calendar object. Codes for extracting information from Calendar object is given below. The other methods are self- explanatory. Newbate day, month, year. int interfaces Comparable NewDate •compareToNewoate o)kint -NewDateo -NewDate(stString) -NewDate(dtCalendar) -setDate(d,m.yintboolean getDateg NewDate -difference(d NewDate) int -compareTo(dNewDate) int -clone0:Object tostring0:String -D interface Cloneable NowTime Fhour, minute, second int interface Comparable NewTime compareTo(NewTime olint -NewTimeo -NewTime(s String) -NewTimetCalendar) -seftime(ss.mm.hhint boolean gefTimeo NewTime -difference(tNswTima)cint -comparaTotNewTimejint cloneo Object -to Sringo Sting -Dinterface Cloneable Create 3 objects with reference variables x, y and z using three constructors. Show the usage of set, get, difference, compareTo, clone and toString methods using these objects in the main method defined in the same class. calendar gc = new Gregoriancalendar (); day = gc.get (Calendar. DAY_OF_MONTH);

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please use NewDate Class.

Define a class based on the UML class diagram according to your NSU ID. Choose NewDate if your
middle four digits of yaur NSU ID is odd, otherwise choose NewTime.
The first constructor initialized with today's date or current time. The second constructor initialized
the object with the given string. The separator of the elements may be ","or :. Use split method
of String class. The third constructor extract Date or Time elements from the given Calendar object.
Codes for extracting information from Calendar object is given below. The other methods are self-
explanatory.
NewDate
day, month, year. int
interface» Comparable <NewDate>
-NewDate)
-NewDate(st String)
-NewDate(dt Calendar)
-setDate(d,m.y.int:boolean
getDateg NewDate
- difference(d NewDate): int
-compareTo(d:NewDate) int
-clone0:Object
+1o String0:String
*compareTo(NewDate o):int
-D interface. Cloneable
NewTime
hour, minute, second: int
winterfacen Comparable <NewTime>
+compareTo(NewTIme o):int
-NewTime)
-NewTime(s.5tring)
-NewTime(tCalendar)
-sefTime(ss,mm,hhint boolean
Fgeflime) NewTime
-difference(tNewTima).int
-comparaTotNewTime)int
-clone0:Object
-to Stringo String
--Dinterfacen Cloneable
Create 3 objects with reference variables x, y and z using three constructors. Show the usage
of set, get, difference, compareTo, clone and toString methods using these objects in the main
method defined in the same class.
Calendar gc = new Gregoriancalendar ();
day = gc.get (Calendar.DAY_OF MONTH);
month = gc.get (Calendar.MONTĦ) +1;
For NewTime choose appropriate fields of the Calendar class.
Transcribed Image Text:Define a class based on the UML class diagram according to your NSU ID. Choose NewDate if your middle four digits of yaur NSU ID is odd, otherwise choose NewTime. The first constructor initialized with today's date or current time. The second constructor initialized the object with the given string. The separator of the elements may be ","or :. Use split method of String class. The third constructor extract Date or Time elements from the given Calendar object. Codes for extracting information from Calendar object is given below. The other methods are self- explanatory. NewDate day, month, year. int interface» Comparable <NewDate> -NewDate) -NewDate(st String) -NewDate(dt Calendar) -setDate(d,m.y.int:boolean getDateg NewDate - difference(d NewDate): int -compareTo(d:NewDate) int -clone0:Object +1o String0:String *compareTo(NewDate o):int -D interface. Cloneable NewTime hour, minute, second: int winterfacen Comparable <NewTime> +compareTo(NewTIme o):int -NewTime) -NewTime(s.5tring) -NewTime(tCalendar) -sefTime(ss,mm,hhint boolean Fgeflime) NewTime -difference(tNewTima).int -comparaTotNewTime)int -clone0:Object -to Stringo String --Dinterfacen Cloneable Create 3 objects with reference variables x, y and z using three constructors. Show the usage of set, get, difference, compareTo, clone and toString methods using these objects in the main method defined in the same class. Calendar gc = new Gregoriancalendar (); day = gc.get (Calendar.DAY_OF MONTH); month = gc.get (Calendar.MONTĦ) +1; For NewTime choose appropriate fields of the Calendar class.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY