1 25 26 package org.objectweb.speedo.pobjects.detach; 27 28 31 public class Car extends Vehicle { 32 33 private int nbOfWheels; 34 private String color; 35 36 public Car(String name, int nbOfWheels, String color) { 37 super(name); 38 setType(Vehicle.CAR); 39 this.nbOfWheels = nbOfWheels; 40 this.color = color; 41 } 42 43 public Car() { 44 super(); 45 setType(Vehicle.CAR); 46 nbOfWheels = 0; 47 color = ""; 48 } 49 50 public String getColor() { 51 return color; 52 } 53 54 public int getNbOfWheels() { 55 return nbOfWheels; 56 } 57 58 public void setColor(String string) { 59 color = string; 60 } 61 62 public void setNbOfWheels(int i) { 63 nbOfWheels = i; 64 } 65 66 public String toString(){ 67 return "Car[ " + super.toString() + ", " + nbOfWheels + ", " + color + "]"; 68 } 69 } 70 | Popular Tags |