Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Book Class 1. Write a program in the Book class that has the following fields: - author : The author field is a String object
Book Class 1. Write a program in the Book class that has the following fields: - author : The author field is a String object that holds the author's name. - title : The title is a String object that holds the book's title. - pages : The pages field is an int variable that holds the number of pages of the book. - publisher : The publisher field is a String object that holds the publisher's title. - phoneNumber: The phone field holds the publisher's phone number. What data type will you use for this field? Why? 2. Write a mutator method for each field that stores a value in the field. 3. Write an accessor method for each field that returns the value stored in the field. 4. Write a method called printBookData that prints the data for the book on a single line with no extra labels or information. Note: This method has a void return type. BookDriver Class Once you have completed the Book class, write a separate program in the BookDriver class that: - creates three book objects that hold the following data: The program should store the data in each row in one of the three objects, then display the data for each object on the screen by calling the printBookData method. For example, a call to the printBookData method for the following object should print something similar to the following output. Book book = new Book(); //setting book information with mutator methods using the data I/Tony Gaddis, Starting out with Java: Early Objects, 1109, Pearson, 9195550550 //call to the printBookData method Tony Gaddis starting eut with lava : Early Objects 11e9 Pearson 9195550550 OddOrEven Class Write a program in the OddOrEven class that: - prompts the user to enter an integer. - displays "The input is odd" to the screen if the input is odd - displays "The input is even" to the screen if the input is even Note: use the exact prompts from the example below. For example, if the user enters 10 , the program displays The input is even. Please enter an integer: 10 The input is even Please complete the Javadoc comments and add any comments you believe are necessary to determine what the program is doing
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