Write a Java class Author with following features:
Instance variable :
o firstName for the authors first name of type String.
o lastName for the authors last name of type String.
Constructor:
o public Author (String firstName, String lastName): A constructor with parameters, it creates the Author object by setting the two fields to the passed values.
Instance methods:
o public void setFirstName (String firstName): Used to set the first name of author.
o public void setLastName (String lastName): Used to set the last name of author.
o public String getFirstName(): This method returns the first name of the author.
o public String getLastName(): This method returns the last name of the author.
o public String toString(): This method printed out authors name to the screen
Write a Java class Book with following features:
Instance variables :
o title for the title of book of type String.
o author for the authors name of type String.
o price for the book price of type double.
Constructor:
o public Book (String title, Author name, double price): A constructor with parameters, it creates the Author object by setting the the fields to the passed values.
Instance methods:
o public void setTitle(String title): Used to set the title of book.
o public void setAuthor(String author): Used to set the name of author of book.
o public void setPrice(double price): Used to set the price of book.
o public String getTitle(): This method returns the title of book.
o public String getAuthor(): This method returns the authors name of book.
o public double getPrice(): This method returns the price of the book.
o public String toString(): This method printed out books details to the screen
Write a separate class BookDemo with a main() method creates a Book titled Developing Java Software with authors Russel Winderand price 79.75. Prints the Books string representation to standard output (using System.out.println).