Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Book { private String title; private String author; private String publisher; private String publicationDate; public Book() { } public Book(String title, String author,
public class Book { private String title; private String author; private String publisher; private String publicationDate; public Book() { } public Book(String title, String author, String publisher, String publicationDate) { this.title = title; this.author = author; this.publisher = publisher; this.publicationDate = publicationDate; } public void setTitle(String userTitle) { title = userTitle; } public String getTitle() { return title; } public void setAuthor(String userAuthor) { author = userAuthor; } public String getAuthor(){ return author; } public void setPublisher(String userPublisher) { publisher = userPublisher; } public String getPublisher() { return publisher; } public void setPublicationDate(String userPublicationDate) { publicationDate = userPublicationDate; } public String getPublicationDate() { return publicationDate; } public void printInfo() { System.out.println("Book Information: "); System.out.println(" Book Title: " + title); System.out.println(" Author: " + author); System.out.println(" Publisher: " + publisher); System.out.println(" Publication Date: " + publicationDate); }
}
import java.util.Scanner; public class BookInformation { public static void main(String[] args) { // TODO: Create a book object with the title of "Really Great Book" written by "Ed Pohl" published on "January 25, 2019" by "Razorback Publishing" // TODO: Create an encyclopedia object with the title of "History of Very Little" written by "Tish Pohl" and published on "March 12, 2020" by "Hillside Ramblings. It is the 3rd edition and contains 2 volumes // TODO: Add both the book and encyclopedia object to an ArrayList containing the appropriate type of object (you determine) // TODO: Loop through the ArrayList and print information about both the book and the encyclopedia } }
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