Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

code about introduction of java 1

http://deanzacollegecis.jenniferparrish.net/home/c…link for activity11.1&11.2

http://deanzacollegecis.jenniferparrish.net/home/c…link for activity12.1&12.2

http://deanzacollegecis.jenniferparrish.net/home/c…link for lab6


Answer the following review questions from Lesson 11 by either typing directly into the textbox below or by uploading a document with your answers. Please include the question along with your answer to make your responses easy to read.

1. Given the below Car class, write a child class of Car named Tesla. The Tesla class has an additional private boolean variable named autoPilotEnabled. It also has two constructors – a default constructor and a three argument constructor. Both constructors call the appropriate constructors of the parent class. Tesla also has a getter and setter for the autoPilotEnabled variable. Finally, it has a toString method that calls the toString of Car, as well as concatenating the autoPilotEnabled variable.

public class Car {   
private String make;
private String model;

public Car() {
make = "Make unknown";
model = "Model unknown";
}

public Car(String make, String model) {
this.make = make;
this.model = model;
}
public String getMake() {
return make;
}

public String getModel() {
return model;
}

public void setMake(String make) {
this.make = make;
}
public void setModel(String model) {
this.model = model;
}

public boolean timeForService(int currMileage) {
if (currMileage > 10000) {
return true;
}
return false;
}

@Override public String toString() {
return "Make: " + make + "nModel: " + model;
}
}

2. Next, override the timeForService method for the Tesla class to return true if the currMileage is greater than 15000.

Answer the following review questions from Lesson 12 by either typing directly into the textbox below or by uploading a document with your answers. Please include the question along with your answer to make your responses easy to read.

1.Given the below Car class, update the default constructor so that it calls the two argument constructor.

public class Car {   
private String make;
private String model;

public Car() {
make = "Make unknown";
model = "Model unknown";
}

public Car(String make, String model) {
this.make = make;
this.model = model;
}
public String getMake() {
return make;
}

public String getModel() {
return model;
}

public void setMake(String make) {
this.make = make;
}
public void setModel(String model) {
this.model = model;
}

public boolean timeForService(int currMileage) {
if (currMileage < 10000) {
return true;
}
return false;
}

@Override public String toString() {
return "Make: " + make + "nModel: " + model;
}
}

2. Next, override the equals method for the above Car class using the formula provided in class.

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"