Question: Create a Java class Book for book objects, with attributes title (the book title), author, publisher, year (the year in which the book was published),

Create a Java class Book for book objects, with attributes title (the book title), author, publisher, year (the year in which the book was published), and price. Furthermore, create a method averagePrice(books, y) in this class which takes two arguments: a list of book objects books and an integer number y which represents a year. Your method should return the average price of those books in list books which have been published in year y. Use, as far as possible, Java 8 Streams and Java 8 Stream operations parameterized with Lambda expressions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!