Question
Java. Please help with the following assignment. Thanks. First: Create an interface definition called Reference. -A Reference refers to a quoted reference from book or
Java. Please help with the following assignment. Thanks.
First:
Create an interface definition called Reference.
-A Reference refers to a quoted reference from book or research paper etc, such as (Savitch, 2016)
-The Reference Interface has two methods:
-getAuthor method that returns a String representing the reference's author
-getYear method that returns an integer representing the copyright year.
Second:
Create a Book class that implements the Reference Interface.
-Instance Variables
-author - String representing the book's author
-year - Integer representing the copyright year published
-title - String representing the book's title
-Constructor that takes in 3 parameters that initialize each of the three instance variables.
-Methods required by the Interface.
Third:
Create a BookStore ClassContains a main method
Creates an ArrayList of type Reference
Add three Book objects to the ArrayList.
Using the appropriate loop type, iterate through the ArrayList
Loop must work for all implementations of Reference, not just for Books, of course.
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