Computers and Technology
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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 09:30, caromaybelline71
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, deflox74
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
image
Computers and Technology, 23.06.2019 19:00, amayax77
Write a program that displays the following menu: geometry calculator 1. calculate the area of a circle 2. calculate the area of a rectangle 3. calculate the area of a triangle 4. quit enter your choice (1-4): if the user enters 1, the program should ask for the radius of the circle and then display its area. use the following formula: area = ď€(the square of r) use 3.14159 for ď€ and the radius of the circle for r. if the user enters 2, the program should ask for the length and width of the rectangle and then display the rectangle’s area. use the following formula: area = length * width if the user enters 3, the program should ask for the length of the triangle’s base and its height, and then display its area. use the following formula: area = base * height * .5 if the user enters 4, the program should end. input validation: display an error message if the user enters a number outside the range of 1 through 4 when selecting an item from the menu. do not accept negative values for the circle’s radius, the rectangle’s length or width, or the triangle’s base or height. note: if the user enters an improper menu choice (1-4), the program prints "the valid choices are 1 through 4. run the program again and select one of those." if the user enters a negative radius, the program prints "the radius can not be less than zero." if the user enters a negative value for height or base, the program prints "only enter positive values for base and height."
Answers: 1
image
Computers and Technology, 23.06.2019 19:40, Latoyajenjins1789
Use a physical stopwatch to record the length of time it takes to run the program. calculate the difference obtained by calls to the method system. currenttimemillis() just before the start of the algorithm and just after the end of the algorithm. calculate the difference obtained by calls to the method system. currenttimemillis() at the start of the program and at the end of the program so that the elapsed time includes the display of the result. use the value returned by the method system. currenttimemillis() just after the end of the algorithm as the elapsed time.
Answers: 3
Do you know the correct answer?
Create a class called ClockNode which has fields for the data (a Clock) and next (ClockNode) instanc...

Questions in other subjects:

Konu
Mathematics, 08.04.2021 20:30