public class Truck extends Vehicle implements java.io.Serializable
Constructor and Description |
---|
Truck(java.lang.String vin,
java.lang.String make,
java.lang.String model,
int year,
double price,
int mileage,
int maxLoadWeight,
double lengthFT)
The constructor for the Truck class.
|
Modifier and Type | Method and Description |
---|---|
(package private) double |
getLengthFT() |
(package private) int |
getMaxLoadWeight() |
(package private) void |
setLengthFT(double lengthFT) |
(package private) void |
setMaxLoadWeight(int maxLoadWeight) |
java.lang.String |
toString()
This method overrides toString to return a nicely formatted string
consisting of all the truck objects fields.
|
static boolean |
validateLengthFT(double lengthFT)
This method validates the length, checking that the number is not negative.
|
static boolean |
validateMaxLoadWeight(int maxLoadWeight)
This method validates the maximum load weight, checking that the number is not
negative.
|
getMake, getModel, getPrice, getVin, getYear, validateMake, validateModel, validatePrice, validateVin, validateYear
public Truck(java.lang.String vin, java.lang.String make, java.lang.String model, int year, double price, int mileage, int maxLoadWeight, double lengthFT)
vin
- The VIN number of the new truckmake
- The manufacturer of the new truckmodel
- The model of the new truckyear
- The year of the new truckprice
- The price of the new truckmileage
- The mileage of the new truckmaxLoadWeight
- The maximum load weight, in pounds, of the new trucklengthFT
- The length of the new truck, in feetpublic static boolean validateMaxLoadWeight(int maxLoadWeight)
maxLoadWeight
- the proposed maximum load weight the truck can acceptpublic static boolean validateLengthFT(double lengthFT)
lengthFT
- the proposed length in feet of the truckpublic java.lang.String toString()
int getMaxLoadWeight()
void setMaxLoadWeight(int maxLoadWeight)
double getLengthFT()
void setLengthFT(double lengthFT)