Question: l Lycamobile 6:50 PM Back a) Create a class named blanket with fields for a blanket's size, color, material, and price. The default constructor sets
l Lycamobile 6:50 PM Back a) Create a class named blanket with fields for a blanket's size, color, material, and price. The default constructor sets the values to Twin, White, Cotton, $30. Write another constructor as well to get the values of the first three fields and CALCULATES the price. The base price is $30. Add $10 to the base price for a double blanket, $25 for a queen blanket, and $40 for a king blanket. Also, add $20 for a wool blanket, and $45 for cashmere. In other words, a king-size cashmere blanket costs $115 ($30+ $40 + $45) while a double wool blanket costs $ 60 ($30+ $10$20). Write a method to display all four fields nicely on the screen. Call your code "Blanket.java" b) Create a child class named ElectricBlanket that extends Blanket and includes two additional fields: one for the number of heat settings, and one for whether it has an automatic shut-off. The default values are 1 and false. Write a default constructor and a user-entered constructor. Add $% to the price of the blanket if the does not have automatic shut-off and $10 if
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
