Book class: • private data members: o bookName: as String o bookAuthor: as object of class Author o publishYear: as int; the year must be >=1; otherwise the default value is 1990 public operations: o parameterized constructor that accepts values for all the class attributes o setters/ getters for each attribute o getBook: that returns a String contains data members values in the following format: bookName by authorName from authorCountry, Publish Year: publishYear (example: Java by Ahmad from Palestine, Publish Year: 2000)
java
i need a book class
Auther class:
public class Author {
private String authorName;
private String authorCountry;
public Author(String authorName, String authorCountry) {
this.authorName = authorName;
this.authorCountry = authorCountry;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getAuthorCountry() {
return authorCountry;
}
public void setAuthorCountry(String authorCountry) {
this.authorCountry = authorCountry;
}
public String getAuthor()
{
return (authorName+" from " + authorCountry);
}
}
Step by step
Solved in 3 steps with 2 images