Question: 1. Define a class named Book that contains An int data field named pages that stores the number of pages in the book. A String

 1. Define a class named Book that contains An int data

1. Define a class named Book that contains An int data field named pages that stores the number of pages in the book. A String data field named title that represents the title of the book. A constructor that accepts and creates a book object with the specified pages and book title The getter and setter methods for all data field A toString method that returns book information including the book title and pages he equals method that returns true if two books have same title and same number of pages The compareTo method that compares two books and returns -1 if the first book has less pages than the second one, +1 if the first book has more pages second one and 0 if both books have same number of pages 2. Write an application TestBooks that asks the user for a number of books read during summer. The application repeatedly creates that many b "smaller" book, i.e. the book with the smaller number of pages, as well as the average number of pages per book read. ook objects and prints to the screen information about the 3. Using the Die class created in Chapter 4, create an application that implements a simple dice game that a user can play against the computer. The object of the game is to be the first to score 100 points after repeatedly rolling 2 dice The program asks the user for a number between 2(the lowest possible total from rolling 2 dice) and 12 (the highest total possible). The user "rolls" 2 dice up to 3 times. If the number chosen by the user comes up, the user wins 5 points. If the number does not come up within 3 rolls, the computer wins 3 points. The program should display weather the user or computer wins the game

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!