Skip to content
Permalink
1487899a10
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
79 lines (63 sloc) 1.49 KB
package com.example.jianhuayang.myxml;
/**
* Created by jianhuayang on 09/10/2017.
*/
public class Vehicle {
public static int counter = 0;
private String make;
private int year;
private String message;
private int price;
private double engine;
public int getPrice() {
return price;
}
public double getEngine() {
return engine;
}
// the default constructor
public Vehicle() {
this.make = "Volvo";
this.year = 2012;
this.message = "This is the default message.";
}
public String getMake() {
return make;
}
/*
* This constructor takes four parameters.
*/
public Vehicle(String make, int year, int price, double engine) {
this.make = make;
this.year = year;
this.price = price;
this.engine = engine;
this.message = "Your car is a " + make + " built in " + year + ".";
count();
}
/**
* @param make the make of your car
*/
public Vehicle(String make) {
this();
this.make = make;
message = "You didn't type in year value.";
count();
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return message;
}
private void count() {
this.counter++;
}
interface Controllable {
void control();
}
}