Lab 3

//Kenny Cruz
//CET 3640
//Lab3
public class MobileDeviceClient {
public static void main(String[] args) {
MobileDevice myMobileDevice = new MobileDevice();
SmartPhone mySmartPhone = new SmartPhone();
iPhone myiPhone = new iPhone();
Android myAndroid = new Android();
WindowsPhone myWindowsPhone = new WindowsPhone();
System.out.println(myMobileDevice.getDeviceType());
System.out.println(mySmartPhone.getDeviceType());
System.out.println(myiPhone.getDeviceType());
System.out.println(myAndroid.getDeviceType());
System.out.println(myWindowsPhone.getDeviceType());
}
}
MobileDevice.java

public class MobileDevice{

private String deviceType = null;

public MobileDevice(){
this.setDeviceType(“Mobile Device”);
}

public String getDeviceType() {
return deviceType;
}

public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}

}
SmartPhone.java

public class SmartPhone extends MobileDevice {

private String deviceType = null;

public SmartPhone(){
this.deviceType = “Smart Phone”;
}

public String getDeviceType(){
return super.getDeviceType() + “–>” + this.deviceType;
}

public void setDeviceType(String deviceType){
super.setDeviceType(deviceType);
}

}
Android.java

public class Android extends SmartPhone{

private String deviceType = null;

public Android(){
this.deviceType = “Android”;
}
public String getDeviceType(){
return super.getDeviceType() + “–>” + this.deviceType;
}

public void setDeviceType(String deviceType){
super.setDeviceType(deviceType);
}
}
iPhone.java

public class iPhone extends SmartPhone {

private String deviceType = null;

public iPhone(){
this.deviceType = “iPhone”;
}

public String getDeviceType(){
return super.getDeviceType() + “–>” + this.deviceType;
}

public void setDeviceType(String deviceType){
super.setDeviceType(deviceType);
}

}
WindowsPhone.java

public class WindowsPhone extends SmartPhone {

private String deviceType = null;

public WindowsPhone(){
this.deviceType = “Windows Phone”;
}

public String getDeviceType(){
return super.getDeviceType() + “–>” + this.deviceType;
}

public void setDeviceType(String deviceType){
super.setDeviceType(deviceType);
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *