code about the introduction of java 1

Are you pressed for time and haven’t started working on your assignment yet? Would you like to buy an assignment? Use our custom writing services for better grades. Even if your deadline is approaching fast, our writers can handle your task right when you need it. Our writers will complete your order from scratch and make sure it’s completely unique.


Order a Similar Paper Order a Different Paper

http://deanzacollegecis.jenniferparrish.net/home/c…link for activity13.1 & 13,2

http://deanzacollegecis.jenniferparrish.net/home/c…link for activity14.1 & 14.2

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


Answer the following review questions from Lesson 13 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. Identify and correct the mistakes in the below program:

public abstract class Dog {

private String name;

private int age;

public Dog() {

name = “No name yet”;

age = 0;

}

public Dog(String name, int age) {

this.name = name;

this.age = age;

}

public String getName() {

return name;

}

public int getAge() {

return age;

}

public abstract void printGreeting();

public void setAge(int age) {

this.age = age;

}

public void setName(String name ) {

this.name = name;

}

@Override public String toString() {

return “Name: ” + name + “nAge: ” + age;

}

}

public class Terrier extends Dog {

private boolean isKidFriendly;

public Terrier(String name, int age, boolean isKidFriendly) {

this.name = name;

this.age = age;

this.isKidFriendly = isKidFriendly;

}

public boolean getIsKidFriendly() {

return isKidFriendly;

}

public void setIsKidFriendly(boolean isKidFriendly) {

this.isKidFriendly = isKidFriendly;

}

@Override public String toString() {

return “Name” + name

+ “nAge: ” + age

+ “nKid-Friendly: ” + isKidFriendly;

}

}

2. Define polymorphism.

3. What will the following display to the console (don’t run the code until you work it out by hand!)

public class Person {

String name;

public Person(String name) {

this.name = name;

}

public void printGreeting() {

System.out.println(“Hi, my name is, ” + name + “!”);

}

}

public class Student extends Person {

double gpa;

public Student(String name, double gpa) {

super(name);

this.gpa = gpa;

}

public void printGreeting() {

super.printGreeting();

System.out.println(“My GPA of ” + gpa + ” is higher than yours!”);

}

}

public class Test {

public static void main(String[] args) {

Person yan = new Person(“Yan”);

Person leann = new Student(“Leann”, 4.0);

Student anh = new Student(“Anh”, 3.95);

yan.printGreeting();

leann.printGreeting();

anh.printGreeting();

}

}

Answer the following review questions from Lesson 14 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. What is the difference between an interface and an abstract class?

    • What advantage does an interface offer over an abstract class?

2. Write an interface as follows:

    • The interface is named ServiceReminder
    • It has one method named timeForService that has no parameters and returns a boolean variable.

3. Now, update the below class so that is inherits from ServiceReminder

    • Note that the next service date should be 90 days from the last service

public abstract class Car {

private double gasGauge;

private double currMileage;

private String color;

private String make;

private String model;

private int daysLastService;

public Car(String color, String make, String model, int daysLastService) {

this.color = color;

this.make = make;

this.model = model;

gasGauge = 0.0;

currMileage = 0.0;

this.daysLastService = daysLastService;

}

@Override public String toString() {

return “Make: ” + make

+ “nModel: ” + model

+ “nColor: ” + color

+ “nGas Gauge: ” + gasGauge;

+ “nCurrent Mileage on this Tank: ” + currMileage

+ “nDays Since Last Service: ” + daysLastService;

}

}

4. Given the below Tesla class, update the class to inherit from the Comparable interface and also write a compareTo method that orders two Tesla objects according to 1. model, 2. range, and 3. color:

public class Tesla {

private String model;

private int range;

private String color;

public Tesla(String model, int range, String color) {

this.model = model;

this.range = range;

this.color = color;

}

@Override public boolean equals(Object o) {

if (this == o) {

return true;

} else if (!(o instanceof Tesla)) {

return false;

} else {

Tesla t = (Tesla) o;

return model.equals(t.model) &&

range == t.range &&

color.equals(t.color);

}

}

}

Need activity 13.1 &13.2 & question about lesson 13 today with 8 hours.

Writerbay.net

Do you need help with this or a different assignment? Even when your task is complicated and the deadline is in less than 2 days, you still have every chance to get a good grade for it. How? By completing the order form, you will get the finest custom-written assignment at an affordable price. We also deliver a number of services for free (e.g., revisions, editing, checking the text for authenticity). Use our paper writing service to receive effective help with your homework.


Order a Similar Paper Order a Different Paper