Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * written by tariq scott
- */
- public class Vehicle {
- private String manName;
- private int numCyl;
- private String ownName;
- public Vehicle ();
- //defaults
- {
- manName = "undefined name";
- numCyl = 0;
- ownName = "undefined name";
- }
- public Vehicle (String amanName, int anumCyl, String aownName);
- //accesors
- public String getmanName()
- {
- return this.manName;
- }
- public int getnumCyl()
- {
- return this.numCyl;
- }
- public String getownName()
- {
- return this.ownName;
- }
- //mutators
- public void setmanName(String amanName)
- {
- this.manName = amanName;
- }
- public void setnumCyl (int anumCyl);
- {
- if (anumCyl >= 0);
- {
- this.numCyl = anumCyl;
- }
- }
- public void setownName (String aownName)
- {
- this.ownName = aownName;
- }
- //other methods
- public String toString()
- {
- return this.manName + " " + this.numCyl + " " + this.ownName;
- }
- public boolean equals (Vehicle aVehicle)
- {
- return aVehicle != null &&
- this.manName.equals(aVehicle.getmanName()) &&
- this.numCyl == (aVehicle.getnumCyl()) &&
- this.ownName.equals(aVehicle.getownName());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement