Question 2: Given the following information . Braun Hair Dryer, 220 Power Voltag
ID: 3704615 • Letter: Q
Question
Question 2: Given the following information . Braun Hair Dryer, 220 Power Voltage, 3m Cord Length, Temperature 220C, 1800 Watt power, Cooling Settings are not available * Baby Liss Hair Straightener, 220-240 Power voltage, 2m Cord Length, Temperature 200C, 15 sec heating time, Ceramic Coating plates, Temperature range 150C-200C, Ionic Styling Technology . Philips Hair Dryer, 220-240 Power Voltage, 3.5m Cord Length, Temperature 220C, 2000 Watt power, Cooling Settings are available . Bruan Hair Straightener, 220-240 Power voltage, 2m Cord Length_Temperature 240C, 20 sec heating time, Metal Coating plates, Temperature range 150C-240C, Anti-Static Styling Technology Drive 3 classes, class HairStyler (a super class), class Dryer and class Straightener (subclasses). Your classes should have whatever variables you think needed to reflect the given information, think carefully what is needed to be assigned to the super class and what should be assigned to the sub classesExplanation / Answer
Please find the below code written in Java. The inheritance relationships are implemented with appropriate attributes in the following classes. The common attributes are defined in the super class and specific attributes are defined in the subclasses.
package inheritance;
public class HairStyler {
private int minVoltage;
private int maxVoltage;
private int cordLength;
private int minTemparature;
private int maxTemparature;
/**
* @param minVoltage
* @param maxVoltage
* @param cordLength
* @param minTemparature
* @param maxTemparature
*/
public HairStyler(int minVoltage, int maxVoltage, int cordLength,
int minTemparature, int maxTemparature) {
this.minVoltage = minVoltage;
this.maxVoltage = maxVoltage;
this.cordLength = cordLength;
this.minTemparature = minTemparature;
this.maxTemparature = maxTemparature;
}
/**
* @return the minVoltage
*/
public int getMinVoltage() {
return minVoltage;
}
/**
* @param minVoltage
* the minVoltage to set
*/
public void setMinVoltage(int minVoltage) {
this.minVoltage = minVoltage;
}
/**
* @return the maxVoltage
*/
public int getMaxVoltage() {
return maxVoltage;
}
/**
* @param maxVoltage
* the maxVoltage to set
*/
public void setMaxVoltage(int maxVoltage) {
this.maxVoltage = maxVoltage;
}
/**
* @return the cordLength
*/
public int getCordLength() {
return cordLength;
}
/**
* @param cordLength
* the cordLength to set
*/
public void setCordLength(int cordLength) {
this.cordLength = cordLength;
}
/**
* @return the minTemparature
*/
public int getMinTemparature() {
return minTemparature;
}
/**
* @param minTemparature
* the minTemparature to set
*/
public void setMinTemparature(int minTemparature) {
this.minTemparature = minTemparature;
}
/**
* @return the maxTemparature
*/
public int getMaxTemparature() {
return maxTemparature;
}
/**
* @param maxTemparature
* the maxTemparature to set
*/
public void setMaxTemparature(int maxTemparature) {
this.maxTemparature = maxTemparature;
}
}
class Dryer extends HairStyler {
private boolean coolingSettings;
/**
* @param minVoltage
* @param maxVoltage
* @param cordLength
* @param minTemparature
* @param maxTemparature
* @param coolingSettings
*/
public Dryer(int minVoltage, int maxVoltage, int cordLength,
int minTemparature, int maxTemparature, boolean coolingSettings) {
super(minVoltage, maxVoltage, cordLength, minTemparature,
maxTemparature);
this.coolingSettings = coolingSettings;
}
/**
* @return the coolingSettings
*/
public boolean isCoolingSettings() {
return coolingSettings;
}
/**
* @param coolingSettings
* the coolingSettings to set
*/
public void setCoolingSettings(boolean coolingSettings) {
this.coolingSettings = coolingSettings;
}
}
class Straightener extends HairStyler {
private int heatingTime;
private String typeOfCoating;
private String stylingTechnology;
/**
* @param minVoltage
* @param maxVoltage
* @param cordLength
* @param minTemparature
* @param maxTemparature
* @param heatingTime
* @param typeOfCoating
* @param stylingTechnology
*/
public Straightener(int minVoltage, int maxVoltage, int cordLength,
int minTemparature, int maxTemparature, int heatingTime,
String typeOfCoating, String stylingTechnology) {
super(minVoltage, maxVoltage, cordLength, minTemparature,
maxTemparature);
this.heatingTime = heatingTime;
this.typeOfCoating = typeOfCoating;
this.stylingTechnology = stylingTechnology;
}
/**
* @return the heatingTime
*/
public int getHeatingTime() {
return heatingTime;
}
/**
* @param heatingTime
* the heatingTime to set
*/
public void setHeatingTime(int heatingTime) {
this.heatingTime = heatingTime;
}
/**
* @return the typeOfCoating
*/
public String getTypeOfCoating() {
return typeOfCoating;
}
/**
* @param typeOfCoating
* the typeOfCoating to set
*/
public void setTypeOfCoating(String typeOfCoating) {
this.typeOfCoating = typeOfCoating;
}
/**
* @return the stylingTechnology
*/
public String getStylingTechnology() {
return stylingTechnology;
}
/**
* @param stylingTechnology
* the stylingTechnology to set
*/
public void setStylingTechnology(String stylingTechnology) {
this.stylingTechnology = stylingTechnology;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.