public class Motorcycle extends Vehicle implements java.io.Serializable
Constructor and Description |
---|
Motorcycle(java.lang.String vin,
java.lang.String make,
java.lang.String model,
int year,
double price,
int mileage,
java.lang.String type,
int displacement)
The constructor for the Motorcycle class.
|
Modifier and Type | Method and Description |
---|---|
(package private) int |
getDisplacement() |
(package private) java.lang.String |
getType() |
(package private) void |
setDisplacement(int displacement) |
(package private) void |
setType(java.lang.String type) |
java.lang.String |
toString()
This method overrides toString to return a nicely formatted string
consisting of all the motorcycle object's fields.
|
static boolean |
validateDisplacement(int displacement)
This method checks whether the displacement is less than 50cc.
|
static boolean |
validateType(java.lang.String type)
Checks to see if the type is blank since there is no set list of types.
|
getMake, getModel, getPrice, getVin, getYear, validateMake, validateModel, validatePrice, validateVin, validateYear
public Motorcycle(java.lang.String vin, java.lang.String make, java.lang.String model, int year, double price, int mileage, java.lang.String type, int displacement)
vin
- The VIN number of the new motorcyclemake
- The manufacturer of the new motorcyclemodel
- The model of the new motorcycleyear
- The year of the new motorcycleprice
- The price of the new motorcyclemileage
- The mileage of the new motorcycletype
- The type of the new motorcycle (cruiser, dual-purpose, etc)displacement
- The displacement in cubic centimeters of the new motorcyclepublic static boolean validateType(java.lang.String type)
type
- - The type of motorcycle (Scooter, Touring, Cruiser, etc.)public static boolean validateDisplacement(int displacement)
displacement
- Integer value representing displacement in cubic centimeterspublic java.lang.String toString()
int getDisplacement()
void setDisplacement(int displacement)
java.lang.String getType()
void setType(java.lang.String type)