subject

Create a class to represent light bulbs Create a class called Bulb that will represent a light bulb. It should have instance variables for the manufacturer (String), part number (String), wattage (int) and lumens (int). Get and Set methods should be included. Override the equals and to String methods from class Object.
List of Bulbs
Create a class called BulbNode which has fields for the data (a Bulb) and next (BulbNode) instance variables. Include a one-argument constructor which takes a Bulb as a parameter. (For hints, see the PowerPoint on "Static vs. Dynamic Structures".)
public BulbNode (Bulb b) {...}
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 BulbList. This should be a linked list with head node as described in lecture. Modify it so that the data type in the nodes is Bulb. 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 BulbList: One called UnsortedBulbList and one called SortedBulbList, each with appropriate no-argument constructors. Each of these classes should have a method called add(Bulb) that will add a new node to the list. In the case of the UnsortedBulbList it will add it to the end of the list by calling the append method in the super class. In the case of the SortedBulbList it will insert the node in the proper position to keep the list sorted by wattage.
Instantiate two linked lists, and for every Bulb 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 Bulbs from the input file in the order they were read, and in the second list the Bulbs will be in sorted order.
Display the unsorted and sorted Bulbs in a GUI with a GridLayout of one row and two columns. Put the unsorted Bulbs in the left column, and the sorted Bulbs in the right column.
The input file
There will be an input file provided on Blackboard which contains information about bulbs, one per line, with the manufacturer, part number, wattage and lumens separated by commas, such as:
Phillips, 1237DF2, 100, 1200
You can separate the four items using a StringTokenizer.
Submitting the Project.
You should now have the following files to submit for this project:
Project2.java
Bulb. java
BulbGUI. java
BulbNode. java
BulbList. java
UnsortedBulbList. java
SortedBulblist. 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.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 13:00, jairus34
We as humans write math expression in infix notation, e. g. 5 + 2 (the operators are written in-between the operands). in a computer’s language, however, it is preferred to have the operators on the right side of the operands, i. e. 5 2 +. for more complex expressions that include parenthesis and multiple operators, a compiler has to convert the expression into postfix first and then evaluate the resulting postfix. write a program that takes an “infix” expression as input, uses stacks to convert it into postfix expression, and finally evaluates it. it must support the following operations: + - / * ^ % (example infix expression: (7 - 3) / (2 + 2)postfix expression: 7 3 - 2 2 + /result: 1guidelines: 1. you will need to use stacks in three placesa. one for the parenthesis check [char stack]b. one during infix to postfix [char stack]c. one during evaluation [int stack]for a and b above, you can use same array and same push, pop method as both ofthem are char. but for evaluation you have int stack and you might consider to createanother push pop method to handle it. maybe push_int, pop_int, etc. or find otherstrategy to utilize existing push pop method2. you can create a function for obtaining operator priority. that function should take anoperator as input and return its priority as an integer. this function will you a lot andreduce repeated code3. during evaluation you will need to convert char into integer. example for single digit: char c = '5'; int x = c - '0';
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, jayjay5246
What is the term for water wave that is created by an underwater earthquake
Answers: 1
image
Computers and Technology, 23.06.2019 00:00, eguzmandpandoracom
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
image
Computers and Technology, 23.06.2019 05:00, bellad0124outlookcom
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
You know the right answer?
Create a class to represent light bulbs Create a class called Bulb that will represent a light bulb...

Questions in other subjects:

Konu
History, 18.09.2021 05:30