subject
Computers and Technology, 21.04.2020 19:36 vhs35

Create a class called ClockNode which has fields for the data (a Clock) and next (ClockNode) instance variables. Include a one-argument constructor which takes a Clock as a parameter. (For hints, see the PowerPoint on "Static vs. Dynamic Structures".)

public ClockNode (Clock c) { . . }
The instance variables should have protected access. There will not be any get and set methods for the two instance variables.

Create an abstract linked list class called ClockList. This should be a linked list with head node as described in lecture. Modify it so that the data type in the nodes is Clock. The no-argument constructor should create an empty list with first and last pointing to an empty head node, and length equal to zero. Include an append method in this class.

Create two more linked list classes that extend the abstract class ClockList: One called UnsortedClockList and one called SortedClockList, each with appropriate no-argument constructors. Each of these classes should have a method called add(Clock) that will add a new node to the list. In the case of the UnsortedClockList it will add it to the end of the list by calling the append method in the super class. In the case of the SortedClockList it will insert the node in the proper position to keep the list sorted.

Instantiate two linked lists, and for every Clock read from the file, add it to the unsorted and sorted lists using the add method. You will end up with the first list having the Clocks from the input file in the order they were read, and in the second list the Clocks will be in sorted order. Display the unsorted and sorted Clocks in the GUI just as in project 1.

Submitting the Project.

You should now have the following files to submit for this project:

Project2.java
Clock. java
ClockGUI. java
ClockNode. java
ClockList. java
UnsortedClockList. java
SortedClockList. java
Submit a jar file.

Rather than upload all the files above separately, we will use Java’s facility to create the equivalent of a zip file that is known as a Java ARchive file, or "jar" file.

Instructions on how to create a jar file using Eclipse are on Blackboard. Create a jar file called Project2.jar and submit that. Be sure the jar file contains source code, not classes.

2:25:24
1:30:00
13:30:00
15:28:39
5:15:45
2:30
2:30:59
29:30:59
2
8:15:12
6:56:34
6:64:34
9:25:00
7:45:42
27:80:75
11:10:00
2:45:00
23:24:25
23:00:00

Add a file menu to your ClockGUI with options to open any file for reading (and displaying the file as in Project 2), and one to Quit the program. You will need a FileMenuHandler class to handle the events from the FileMenu. Be sure to use getAbsolutePath() when getting the file from the JFileChooser, not getName().

Handle Exceptions

A data file will be provided that will contain errors (e. g., hours > 23, minutes > 59, seconds > 59). Create and exception called IllegalClockException (by extending IlegalArgumentException as shown in lecture) and have the constructor of the Clock throw it. Use a try/catch statement to catch this exception in your program, and print the erroneous clock to the console (do not add it to the linked lists).

Create a jar file called Project3.jar and submit that to Blackboard by the due date for full credit.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
Which of the following has not been attributed at least in part to social media a. drug addiction b. depression c. kidnapping d. murder
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
In the context of an internet connection, llc stands for leased line connection liability limited company local loop complex local loop carrier
Answers: 1
question
Computers and Technology, 24.06.2019 17:30
List at least one thing to check for when you're checking the clarity and professionalism of a document.
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Is the process of organizing data to reduce redundancy. a. normalization b. primary keying c. specifying relationships d. duplication
Answers: 1
You know the right answer?
Create a class called ClockNode which has fields for the data (a Clock) and next (ClockNode) instanc...
Questions