Question: Java Class: In NetBeans The first constructor, TextBook(), doesn't have a parameter. lt assigns to title, 0.0 to price, 0 to courselD; . The

Java Class: In NetBeans

Java Class: In NetBeans The first constructor, TextBook(), doesn't have a parameter.

The first constructor, TextBook(), doesn't have a parameter. lt assigns "" to title, 0.0 to price, 0 to courselD; . The second constructor, TextBook(String, double, int) uses three passed-in parameters to initialize the three attributes. * toString() in TextBook returns a string value for the three attributes, title, price, and courselD Book Questions: 1) Define a child class, TextBook, based on above requirement. - title: String price: double + Book() + Book(String, double) + getTitle(): String + setTitle(String): void + getPrice(): double + setPrice(double): void + toString(): String 2) Define another class, TextBookApp. This TextBookApp class interacts with the Book and TextBook classes as follows: 2.1) Create a Book object, named b, by calling the second Book constructor and passing "Ann Smith" as the first argument and 9.2 as the second argument. Use b to call toString() method and print the returned value from the toString() method. 2.2) Create a TextBook object, named tb1, by calling the first TextBook constructor. Then using the object tb1 to call methods to assign "John Doe" to title, 8.1 to price, and 2050 to courselD. Finally, using tb1 to call toString() method and print out the returned value, TextBook - courseID: int + TextBook() + TextBook(String, double, int) + getCourselD(): int + setCourselD(int): void + toString(): String 2.3) Create another TextBook object, named tb2, by calling the second TextBook constructor and passing "Ann Smith" as the first argument, 9.2 as the second argument, and 3090 as the third parameter. Use tb2 to call toString() method and print out the returned value. 2.4) Run TextBookApp to make sure it works correctly

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!