Question: please answer the 2 java questions asap. Need it soon. Q1) Write a class called Book in java that has the following instance variables: String

please answer the 2 java questions asap. Need it soon. Q1) Write a class called Book in java that has the following instance variables: String title int pages along with the required accessor and toString methods. Now write a subclass Textbook of this class Book that has the following additional instance variable String course Override the getTitle() method of the Book class by printing the title of the book and the course as well. Provide another accessor method getCourse(). Now in a main class, create an array of 10 books with some of them being textbooks. Using a for-loop print their titles, number of pages and if it is a textbook, then its course. Finally, count the number of textbooks, the number of books and print their quantities. Q2) Design an abstract class Student. A student has the following information: ID and GPA. The student class has an abstract method getStatus that returns the status as a string and a non-abstract final method displayStudent that prints the details of a student. Design two subclasses Undergraduate and Graduate. The status of the graduate student is good if his GPA is 3.0 or above otherwise it is probation. The undergraduate's status is honor if his GPA is 3.0 or above, good if his GPA is 2.0 or above, probation otherwise. Write a test class that randomly generates 10 students and prints their ID, GPA and status.

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!