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
Get step-by-step solutions from verified subject matter experts
