1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svet-max [94.6K]
3 years ago
5

Create a class called ClockNode which has fields for the data (a Clock) and next (ClockNode) instance variables. Include a one-a

rgument 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.
Computers and Technology
1 answer:
zimovet [89]3 years ago
4 0
Idk ....................
You might be interested in
A line of code that begins with the while needs to end which symbol?<br> # <br> "<br> :<br> .
olga_2 [115]
<h2>A line of code that begins with the "while" needs to end with <u>":"</u> symbol</h2>

Explanation:

In python, the while loop statement has ":" at the end of the line.

<u>Syntax:</u>

while expression:

code(s) or statement(s)

<u>Example:</u>

cnt = 0

while (cnt < 5):

  print 'cnt:', cnt

  cnt = cnt + 1

Like other programming languages, while loop works in the same way except that in python it comes alone with "else" statement. When the condition is false, "else" statement gets executed.

<u>Example:</u>

#!/usr/bin/python

cnt = 0

while cnt < 5:

  print cnt, " is  less than 5"

  cnt = cnt + 1

else:

  print cnt, " is not less than 5"

3 0
3 years ago
Name the following hardware device to write the data from hard disk to CD ​
lys-0071 [83]

Answer:

CD Writer or DVD Writer

Explanation:

The DVD Writer/CD Writer is a multipurpose rewriteable drive that can read audio, data, and video files and can record, or write, in both CD and DVD formats. This DVD Writer/CD Writer drive enables you to: Create custom audio, data, and video files that can be recorded onto CDs or DVDs. Store large amounts of data.

7 0
4 years ago
PLEASE I NEED HELP ASAP PLEASE PLEASE!!!
aniked [119]

Answer:

Following are the program in the Python Programming Language

#set variables to 0

positive_sum=0  

negative_sum=0  

#print message  

print("Enter 0 to terminate")  

#set the while loop  

while(True):  

#get input from the user  

num=float(input("Enter positive or negative numbers: "))  

#set if statement to check condition  

if(num==0):  

  break  

elif(num>0):  

  positive_sum+=num  

else:  

  negative_sum+=num  

#print output with message  

print()  

print("sum of positive numbers: ", positive_sum)  

print("sum of negative numbers: ", negative_sum)  

Output:  

Enter 0 to terminate  

Enter positive or negative numbers: 1  

Enter positive or negative numbers: 3  

Enter positive or negative numbers: 5  

Enter positive or negative numbers: -7  

Enter positive or negative numbers: -2Enter positive or negative numbers: 0  

sum of positive numbers:  9.0  

sum of negative numbers:  -9.0

Explanation:

Here, we set two integer data type variables "positive_sum", "negative_sum" and initialize to 0.

Then, we set the while infinite loop inside the loop.

Set a variable "num" and get input from the user in it.

Set the if conditional statement and check condition the variable "num" is equal to 0 then, loop will terminate.

Set the elif statement and check condition the variable "num" is greater than 0 then, add that input and store in the variable "positive_sum"

Otherwise, add that input and store in the variable "negative_sum".

Finally, we print the output with the message.

8 0
2 years ago
What steps will add content to a report header section?
devlian [24]

Answer: 1. Design 2. Section divider or blank area 3. Controls 4. Property sheet

Explanation:

Edge2020

5 0
3 years ago
Read 2 more answers
A shop will give discount of 10% if the cost of purchased quantity is more than 1000. Ask user for quantity suppose, one unit wi
Mamont248 [21]

Answer:

The program in C++ is as follows:

#include <iostream>

using namespace std;

int main(){

   int qty;

   float discount = 0;

   cout<<"Quantity: ";

   cin>>qty;

   int cost = qty * 100;

i f (cost > 1000) {        discount=cost * 0.10;        }

   cout<<"Cost: "<<cost - discount;

   return 0;

}

Explanation:

This declares the quantity as integer

   int qty;

This declares and initializes discount to 0

   float discount = 0;

This prompts the user for quantity

   cout<<"Quantity: ";

This gets input for quantity

   cin>>qty;

This calculates the cost

   int cost = qty * 100;

If cost is above 1000, a discount of 10% is calculated

i f (cost > 1000) {        discount=cost * 0.10;        }

This prints the cost

   cout<<"Cost: "<<cost - discount;

4 0
3 years ago
Other questions:
  • My window key dont work and I dont have a fn button, what can I do?<br> PLS help me.
    12·1 answer
  • 10010010 + 01100010 =
    11·1 answer
  • Which feature enables you to make changes to all the slides of your presentation at the same time?
    8·1 answer
  • Create a page using PHP for a business website that will ask the user to enter his or her name into text boxes and will display
    5·1 answer
  • Computers help eliminate that repetitive of manual task. How can this benefit you in in your overall career
    7·2 answers
  • How did the new technologies of WWI affect soldiers fighting on the front lines? Please include at least three examples of new t
    5·1 answer
  • The length of the hypotenuse of a right-angled triangle is the square root of the sum of the squares of the other two sides. Wri
    7·1 answer
  • How do you select a single cell, a single column, a single
    10·1 answer
  • Let cell E2 = 100, what is the result of this formula? =NOT(E2&lt;100) *
    13·1 answer
  • When scriptwriters are writing scripts, why do they have to write them in accordance with industry standards?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!