Question
2. In the Java collection framework, there are classes for stacks, FIFO queues and priority queues. How do these three data structures differ? Give examples of applications where each of these three would be useful.
3. Design, write and test the Java program FP.java with the following requirements:
Consider an input data file which contains 20 pairs color – hexadecimal value, each pair representing a color and its associated hexadecimal value (for example Red FF0000). In the input file, each pair color – hexadecimal value should be on a separate line. Read the pairs and store them in appropriate Java Collection Framework (JCF) collection(s). Give reasons for the chosen JCF collection(s).
Sort the pairs in the increasing order of their hexadecimal values and use iterators to display the sorted pairs to the console.
Using a GUI, display the pairs as radio buttons. When the user selects a radio button, the background of the GUI should change to that color.
Notes.
1. Using GUI automatic generation facilities of IDEs is not accepted.
2. The input file containing the pairs color – hexadecimal value should be manually (off-line) created using a basic text editor (such as Notepad).
1. The source file FP.java and the input file.
2. A document file (.pdf or .doc/.docx) describing your solution which should include the following sections: (1) A short problem analysis, (2) Design decisions and assumptions, (3) Short description of classes, (4) User interface, (5) Relevant test cases and screenshots, (6) Error handling, (7) Lessons learned and (8) Possible future developments. The size of the document should be of 3 pages, single spaced, font size 12.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.