Question: final method Exercise 8-1 Use inheritance with the Product application In this exercise, you'll modify the Product application shown in this chapter so it

final method Exercise 8-1 Use inheritance with the Product application In this

 


 

final method Exercise 8-1 Use inheritance with the Product application In this exercise, you'll modify the Product application shown in this chapter so it provides for an additional kind of product: a music album. When you enter the code for a music album, it should look like this: Enter product code: sgtp Description: Sgt. Peppers (The Beatles) $14.99 Price: Product count: 1 Create a new subclass named Album 1. Open the project named ch08_ex1_Product that's in the ex_starts folder. Then, review the code. 2. Create a new class named Album that inherits the Product class. This new class should store data about the artist of the album. In addition, its toString() method should append the name of the artist to the end of the string as shown above. Modify the ProductDB class so it returns an Album object 3. Modify the ProductDB class so it creates at least one Album object. 4. Run the application to make sure that it works correctly. Modify the protected variable 5. Open the Product class and delete the protected access modifier for the count variable. This restricts the availability of this variable even further, making it only available to the other classes in the current package. 6. Run the application to make sure that the count is maintained properly.

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 Programming Questions!