package com.vidyasource.tutorial.comparison;

public class Car implements Comparable<Car> {
    private int price;
    private String make;

    public Car(int price, String make) {
        this.price = price;
        this.make = make;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getMake() {
        return make;
    }

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

    @Override
    public int compareTo(Car car) {
        if (car == null) {
            throw new NullPointerException("Attempted to compare " + this + " to null");
        } else if (price < car.price) {
            return -1;
        } else if (price > car.price) {
            return 1;
        }

        return 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) {
            return false;
        } else {
            return compareTo((Car) o) == 0;
        }
    }

    @Override
    public int hashCode() {
        int result = price;
        result = 31 * result + make.hashCode();

        return result;
    }

    @Override
    public String toString() {
        return make;
    }
}

@@ -279,16 +279,21 @@
  return 
+this.
 price;%0A 
@@ -408,32 +408,37 @@
 %0A        return 
+this.
 make;%0A    %7D%0A%0A   
@@ -549,17 +549,22 @@
 eTo(Car 
-c
+otherC
 ar) %7B%0A  
@@ -573,17 +573,22 @@
     if (
-c
+otherC
 ar == nu
@@ -705,16 +705,21 @@
 if (
+this.
 price %3C 
 car.
@@ -714,17 +714,22 @@
 price %3C 
-c
+otherC
 ar.price
@@ -778,16 +778,21 @@
 if (
+this.
 price %3E 
 car.
@@ -787,17 +787,22 @@
 price %3E 
-c
+otherC
 ar.price
@@ -1173,16 +1173,21 @@
 esult = 
+this.
 price;%0A 
@@ -1216,16 +1216,21 @@
 esult + 
+this.
 make.has

Make private members clearer