In Java langauge, please show the output of the program. Thank you

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In Java langauge, please show the output of the program. Thank you

Create a Book object that has a book written by only one author. The class contains the following
members:
1. Four private data members: bookTitle (string), author (an instance of the class
Author), price (double), and stock (int, with default value of 0). The price shall be
positive and the stock shall be zero or positive. Take note that data member author is an
instance of the class Author, instead of a fundamental types (such as int, double,etc.).
2. The public getters and setters for the private data members. Take note that
getAuthor () returns an object (an instance of class Author).
Book Title : Java Book
: Marcus Laurence
: Male
: milaurence@neu.edu.ph
AUTHOR
3. A method print(), which prints
GENDER
E-MAIL
4. A method getAuthorName (), which returns the name of the author of this Book instance.
5. Use the BookTest for your reference:
Sample 1:
public class BookTest
public static void main(String[] args)
{
// Declare and construct an instance of Author
Author authori = new Author ("Marcus Laurence", "milaurence@neu.edu.ph", "Male");
author1.print();
Transcribed Image Text:Create a Book object that has a book written by only one author. The class contains the following members: 1. Four private data members: bookTitle (string), author (an instance of the class Author), price (double), and stock (int, with default value of 0). The price shall be positive and the stock shall be zero or positive. Take note that data member author is an instance of the class Author, instead of a fundamental types (such as int, double,etc.). 2. The public getters and setters for the private data members. Take note that getAuthor () returns an object (an instance of class Author). Book Title : Java Book : Marcus Laurence : Male : milaurence@neu.edu.ph AUTHOR 3. A method print(), which prints GENDER E-MAIL 4. A method getAuthorName (), which returns the name of the author of this Book instance. 5. Use the BookTest for your reference: Sample 1: public class BookTest public static void main(String[] args) { // Declare and construct an instance of Author Author authori = new Author ("Marcus Laurence", "milaurence@neu.edu.ph", "Male"); author1.print();
Author author1 = new Author("Marcus Laurence", "milaurence@neu.edu.ph", "Male");
author1.print();
// Declare and construct an instance of Book
Book bk1 = new Book("Java Book", author1, 1499, 10);
bk1.print();
author1.setEmail("cuscus@gmail.com");
author1.print();
bk1.print();
bk1.getAuthor ().setEmail("Laurence.marcus@gmail.com");
bk1.print();
AUTHOR
: Marcus Laurence
GENDER : Male
E-MAIL : milaurence@neu.edu.ph
Book Title : Java Book
AUTHOR : Marcus Laurence
GENDER : Male
E-MAIL : milaurence@neu.edu.ph
AUTHOR
: Marcus Laurence
: Male
: cuscus@gmail.com
GENDER
E-MAIL
Book Title : Java Book
AUTHOR
: Marcus Laurence
GENDER : Male
E-MAIL : cuscus@gmail.com
Book Title : Java Book
: Marcus Laurence
: Male
: Laurence.marcus@gmail.com
AUTHOR
GENDER
E-MAIL
Transcribed Image Text:Author author1 = new Author("Marcus Laurence", "milaurence@neu.edu.ph", "Male"); author1.print(); // Declare and construct an instance of Book Book bk1 = new Book("Java Book", author1, 1499, 10); bk1.print(); author1.setEmail("cuscus@gmail.com"); author1.print(); bk1.print(); bk1.getAuthor ().setEmail("Laurence.marcus@gmail.com"); bk1.print(); AUTHOR : Marcus Laurence GENDER : Male E-MAIL : milaurence@neu.edu.ph Book Title : Java Book AUTHOR : Marcus Laurence GENDER : Male E-MAIL : milaurence@neu.edu.ph AUTHOR : Marcus Laurence : Male : cuscus@gmail.com GENDER E-MAIL Book Title : Java Book AUTHOR : Marcus Laurence GENDER : Male E-MAIL : cuscus@gmail.com Book Title : Java Book : Marcus Laurence : Male : Laurence.marcus@gmail.com AUTHOR GENDER E-MAIL
Expert Solution
steps

Step by step

Solved in 4 steps with 8 images

Blurred answer
Knowledge Booster
Files and Directory
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.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education