Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * written by tariq scott
- */
- public class Truck extends Vehicle{ //so i dont have to recreate the same verbs
- private double loadCap;
- private double towCap;
- public Truck()
- {
- super();
- loadCap = 0.0; //both of these variables are indicating no number at the moment
- towCap = 0.0;
- }
- public Truck (double aloadCap, double atowCap)
- {
- super (manName, numCyl, ownName);
- this.setloadCap(aloadCap);
- this.settowCap(atowCap);
- }
- //accessors
- public double getloadCap ();
- {
- return this.loadCap;
- }
- public double gettowCap () ;
- {
- return this.towCap;
- }
- //mutators
- public void setloadCap(double aloadCap)
- {
- if (loadCap >= 0)
- {
- this.loadCap = aloadCap;
- }
- }
- public void settowCap(double atowCap)
- {
- if (towCap >= 0)
- {
- this.towCap = atowCap;
- }
- }
- //other methods
- public String toString ()
- {
- return super.toString() + "\t " + this.loadCap + " " + this.towCap + " ";
- }
- public boolean equals(Truck aTruck)
- {
- return aTruck != null &&
- super.equals(aTruck) &&
- this.loadCap == aTruck.getloadCap() &&
- this.towCap == aTruck.gettowCap();
- }
- }
Add Comment
Please, Sign In to add comment