Question: reate a class named Blanket with fields for a Blanket's size ( size ) , color ( color ) , material ( material ) rice

reate a class named Blanket with fields for a Blanket's size (size), color (color), material (material) rice (price).
nclude a constructor that sets default values for the fields as twin, white, cotton, and $30.00.
Include set and get methods for each of the first three fields. The method that sets size adds $10 to the price for a double blanket, $25 for a queen blanket, and $40 for a king.
info> There should be four acceptable sizes: twin, double, queen, and king.
The method that sets the material adds $20 to the price for wool and $45 to the price for cashmere. In , words, the price for a kirig-sized cashmere blanket is $115. Whenever the size or material is invalid, rese blanket to the default values.
info> There should be three acceptable materials: cotton, wool, and cashmere.
Include a toString() method that returns a description of the blanket.
Part B
Create a child class named ElectricBlanket that extends Blanket and includes two additional fields: on the number of heat settings (settings) and one for whether the ElectricBlanket has an automatic sh feature (hasAutoShutoff). Default values are 1 for settings and false for hasAutoShutoff.
Include get and set methods for the fields. Do not allow the number of settings to be fewer than one or than five; if it is, use the default setting of 1. Add a $5.75 premium to the price if the blanket has the autor shutoff feature.
Also include a toString() method that calls the parent class toString() method and combines the retL value with data about the new fields to return a comolete describtion of features.
 reate a class named Blanket with fields for a Blanket's size

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!