I\'ve already posted this once. I just would like to see another possible soluti
ID: 3877097 • Letter: I
Question
I've already posted this once. I just would like to see another possible solution.
I have the UML for the java program that I'm supposed to create. This is what my professor says:
Review the attached UML diagram, and build a Java program to apply your knowledge by designing the required interfaces and the classes.
Create the main method and declare three objects, one of type Book, one of type Journal, and one for a Chapter.
Call all the methods and display the references details using one of the Formats.
IFormattableReference for matMLA for matAPA for mat Chicaao Reference author :name pubDate Calendar setAuthor setTitle setPubDate(m,d,y) set PubDatem,y) set PubDately) getAuthor getTitle get Pub Date( m,d,y) getPubDate(m,y] getPubDately) Book publisher volume number pages set Source setVolume set Number setPages get Source getVolume get Number getPages state country setPublisher set State getPublisher get City get State etCountr Chapter editor name () bookTitle pages setEditor set BookTitle getEditor getBookTitle getPagesExplanation / Answer
public class Book {
private String title;
private String author;
private String publisher;
private int copyRightDate;
public Book(String bookTitle, String authorName, String publisherName,
int date) {
title = bookTitle;
author = authorName;
publisher = publisherName;
copyRightDate = date;
}
public Book() {
title = "Citizen";
author = "Anthony";
publisher = "Picinini";
copyRightDate = 2005;
}
public void setAuthor(String authorName) {
author = authorName; }
public String getAuthor() {
return author; }
public void setTitle(String bookTitle) {
title = bookTitle; }
public String getTitle() {
return title; }
public void setPublisher(String publisherName) {
publisher = publisherName; }
public String getPublisher() {
return publisher;}
public void setCopyRightDate(int date) {
copyRightDate = date; }
public int getCopyRightDate() {
return copyRightDate; }
public String toString() {
return (title + " " + author + " " + publisher + " " + copyRightDate);
}
}
////////////////////////////////////////////////////////////////////////////////////
public class Bookshelf {
public static void main(String[] args) {
final int year2 = 1991;
final int year3 = 2009;
// creates Book object
Book name1 = new Book("Java ", "Tenzin ", "Fred ", year2);
Book name2 = new Book("Html ", "Namdak ", "Tom ", year3);
System.out.println(name1);
System.out.println(name2);
}
}