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)

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

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);         
    }
    
}

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)
Transcribed Image Text: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)
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,