Question: Suppose that two different types of sources are used in a term paper: books and journal articles. The following UML diagram illustrates how the sources

Suppose that two different types of sources are used in a term paper: books and journal articles. The following UML diagram illustrates how the sources are organized.

Book publisher: String Source author: String title: String year: int Circle (author:

First, implement the three classes, Source, Book, and Article, and then write a main method to use them. In the main method, ask the user to enter the number of references, create an array of type Source using the size the user entered, use a loop to ask the user to enter the information for each reference (book or journal article), and then output the contents of each object.

Book publisher: String Source author: String title: String year: int Circle (author: String, title: String, year: int) toString(): String Book (author: String, title: String, year: int, publisher: String) toString(): String equals (aBook: Book): Boolean Article journalName: String pages: String volume: int issue: int Article (author: String, title: String, year: int, journalName: String, pages: String) toString(): String equals (aArticle: Article): Boolean

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The UML diagram you provided describes a class inheritance hierarchy where Book and Article are subclasses of the Source class Below is a simple Java implementation of these three classes After that I... View full answer

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 Introduction Java Program Questions!