Question
Hi I need this in Java Please submit your work on the blackboard. For this assignment you need to submit the source code (.java) files.
Hi I need this in Java
Please submit your work on the blackboard. For this assignment you need to submit the source code (.java) files.
Q1 (10 points): Design two classes named Author and Book as follow:
The Author class should have:
A private String data field named name.
A private String data field named email.
A private String data field named gender.
A constructor of the Author class that have three parameters of type String used to initialize the instance variables name, email and gender.
Accessor method called getName that returns the name instance variable.
The Author class has one method called GetAuthorInformation(), return type String with no parameters. This method returns the concatenation of the author name, email and gender. The Book class should have
A private String data field named title.
A private variable of type Author, to store the author information
A constructor of the Book class has two parameters: one of type String (the book title) and one of type Author that holds the author information. The constructor initializes the instance variables.
The Book class has one method called GetBookInformation(), return type String with no parameters. This method returns the concatenation of the title with the string ", by and the author's name (using the author object's getName method). Write a test program that creates an instance of an author object and a book written by that author. You will then use the System.out.println method to print the book object.
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