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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started