Elon's Toy Car
public class ElonsToyCar {
private int distance = 0;
private int battery = 100;
public static ElonsToyCar buy() {
ElonsToyCar car = new ElonsToyCar();
return car;
}
public String distanceDisplay() {
return "Driven " +distance + " meters";
}
public String batteryDisplay() {
return battery==0 ? "Battery empty":"Battery at " + battery+ "%";
}
public void drive() {
if(battery!=0)
{
battery -= 1;
distance +=20;
}
}
}
Thank you, friend!
I'm @steem.history, who is steem witness.
Thank you for witnessvoting for me.
please click it!
(Go to https://steemit.com/~witnesses and type fbslo at the bottom of the page)
The weight is reduced because of the lack of Voting Power. If you vote for me as a witness, you can get my little vote.