Starting from:

$25

ITSE2317- Program 5 Solved

Use the class, Invoice, provided to create an array of Invoice objects.  Class Invoice includes four instance variables; partNumber (type String), partDescription (type String), quantity of the item being purchased (type int0, and pricePerItem (type double). Perform the following queries on the array of Invoice objects and display the results:

 

a.    Use streams to sort the Invoice objects by partDescription, then display the results.

b.    Use streams to sort the Invoice objects by pricePerItem, then display the results.

c.    Use streams to map each Invoice to its partDescription and quantity, sort the results by quantity, then display the results 

d.    Use streams to map each Invoice to its partDescription and the value of the Invoice (i.e., quantity * pricePerItem).  Order the results by Invoice value.

e.    Modify Part (d) to select the Invoice values in the range $200.00 to $500.00.

f.      Find any one Invoice in which the partDescription contains the word “saw”.

 

Use the data below to test your program.

 

Run your program and copy and paste the output to a file.  Create a folder named, fullname_program5.  Copy your source code and the output file to the folder.  Zip the folder and upload it to Blackboard

 

 

Invoice Data
 

Part Number
Part Description
Quantity
Price
83
Electric sander
7
57.98
24
Power saw
18
99.99
7
Sledge hammer
11
21.50
77
Hammer
76
11.99
39
Lawn mower
3
79.50
68
Screwdriver
106
6.99
56
Jig saw
21
11.00
3
Wrench
34
7.50
 

More products