Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

CSIS 505 Page 1 of 2 HOMEWORK 3 INSTRUCTIONS Overview In this module/week’s homework assignment, you will complete 2 exercises that will allow you to practice your skill with the topics of generic...

1 answer below »
CSIS 505
Page 1 of 2
HOMEWORK 3 INSTRUCTIONS

Overview
In this module/week’s homework assignment, you will complete 2 exercises that will allow you
to practice your skill with the topics of generic collections, lambdas, and streams that you
learned about in the Reading & Study materials for this module/week.
Instructions
1. Refer to the Homework Grading Ru
ic before you begin this assignment.
2. Complete the detailed instructions for each exercise included in the sections below. For
each exercise, begin with a new Java project.
3. As you write your code, provide all pertinent documentation in the form of JavaDoc
comments for all classes and methods.
a. All class-level comments must include a description of the class along with your
nameand links to any resources you used (other than the textbook) while writing
your code.
. Each method must also have a comment that indicates the purpose of the method
and, if applicable, the purpose of all parameters and return value.
c. Additional in-line comments must be used to explain complex algorithms or
unique solutions to the problem.
4. Print, sign, and scan (or take a photo of) the Pledge of Academic Integrity.
5. After you have completed the exercises for this assignment, submit the following via the
Blackboard submission link: a digital copy of your signed pledge sheet, a compressed
folder containing your code, and any additional written requirements specified below:
Test your code completely. At each step of the test take a screen shot and embed it
into a Word document. At the completion of the test compress (ZIP) the Word
document and your code into one ZIP file. Submit the ZIP file to the appropriate
assignment.
Failure to submit a signed pledge of academic integrity for this assignment will
esult in an automatic grade of zero (0) for this assignment.
Exercise 1
Use a HashMap to create a reusable class for choosing one of the 13 predefined colors in class
Color. The names of the colors will be used as keys, and the predefined Color objects will be
used as values. Place this class in a package that can be imported into any Java program. Use
your new class in a GUI application that allows the user to select one of the colors from a
JList. The JList should receive its values from the HashMap programmatically. When the
CSIS 505
Page 2 of 2
user clicks a button, the application must change the background color of a JPanel to the
cu
ently selected color in the JList.
Exercise 2
1. Create an Invoice class with 4 attributes: PartNumber (type int),
PartDescription (type String), Quantity (type int), and Price (type
double).
2. Create a constructor that allows you to initialize all 4 attributes from values passed in as
parameters.
3. Ove
ide the toString() method to display all 4 attributes in a format of your
choosing.
4. Create a List of 10 Invoices containing data of your choosing.
5. Use lambdas and streams to perform the following queries on the list of Invoice objects
and display the results:
a. Sort the Invoice objects by PartDescription, then display the results.
. Sort the Invoice objects by Price, then display the results.
c. Map each Invoice to its PartDescription and Quantity, sort the results
y Quantity, then display the results.
d. Map each Invoice to its PartDescription and the value of the Invoice
(i.e., Quantity * Price). Order the results by Invoice value.
e. Modify Part (d) above to select the Invoice values in the range of $200 to $500
(inclusive) and display the results separately.
Submit this assignment by 11:59 p.m. on Sunday of Module/Week 3.
Answered Same Day Nov 12, 2021

Solution

Aditya answered on Nov 15 2021
162 Votes
public class Invoice {

private int partNumber;
private String type;
private int quantity;
private double price;
public Invoice(int partNumber, String type, int quantity, double price) {
this.partNumber = partNumber;
this.type = type;
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here