Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Auto Generated Java Class.
- */
- public class Car extends Vehicle {
- private double gas;
- private int passengers;
- public Car()
- {
- super ();
- gas = 0.0;
- passengers = 0;
- }
- public Car (double aGas, int aPassengers)
- {
- super (manName, numCyl, ownName);
- this.setGas(aGas);
- this.setPassengers(aPassengers);
- }
- //accessors
- public double getGas()
- {
- return this.gas;
- }
- public int getPassengers()
- {
- return this.passengers;
- }
- //mutators
- public void setGas(double aGas)
- {
- if (gas >= 0)
- {
- return this.gas;
- }
- }
- public void setPassengers (int aPassengers)
- {
- if (passengers >= 0)
- {
- return this.passengers;
- }
- }
- //other methods
- public String toString ()
- {
- return super.toString() + "\a " + this.gas + " " + this.passengers + " ";
- }
- public boolean equals (Car aCar)
- {
- return aCar != null &&
- super.equals(aCar) &&
- this.gas == aCar.getGas () &&
- this.passengers == aCar.getPassengers();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement