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 13:30
Write lines of verse that rhyme to remember the following information: acid rain is a type of air pollution caused by chemicals in the air.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
3. what is the output of the following statements? temporary object1; temporary object2("rectangle", 8.5, 5); temporary object3("circle", 6, 0); temporary object4("cylinder", 6, 3.5); cout < < fixed < < showpoint < < setprecision(2); object1.print(); object2.print(); object3.print(); object4.print(); object1.set("sphere", 4.5, 0); object1.print();
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
It is not necessary to develop strategies to separate good information and bad information on the internet. true or false
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
question
Mathematics, 23.03.2021 01:20
question
Mathematics, 23.03.2021 01:20
question
Mathematics, 23.03.2021 01:20
Questions on the website: 13722363