Problem

(Manipulating a Stream) Use the class Invoi ce provided in the exercises folder with this...

(Manipulating a Stream) Use the class Invoi ce provided in the exercises folder with this chapter's examples to create an array of Invoice objects. Use the sample data shown in Fig. 2. Class Invoice includes four properties—a PartNumber (type int), a PartDescription (type String), a Quantity of the item being purchased (type int) and a Price (type double). Perform the following queries on the array of Invoice objects and display the results:

a) Use lambdas and streams to sort the Invoice objects by PartDescription, then display the results.

b) Use lambdas and streams to sort the Invoi ce objects by Price, then display the results.

c) Use lambdas and streams to map each Invoice to its PartDescription and Quantity, sort the results by Quantity, then display the results.

d) Use lambdas and streams to 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) to select the Invoice values in the range $200 to $500.

Fig. 2 Sample data for Exercise.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 17
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT