========
public class TestTikus {
public static void main (
String[] args) {
Tikus t = new Tikus();
t.setWeight(10);
System.out.println("Tikus ni berat:"+ t.getWeight());
}
}
=========
public class Tikus {
private float weight;
public float getWeight() {
return weight;
}
public void setWeight(float newWeight) {
if (newWeight > 0) {
weight = newWeight;
}
}
}
=======
output:10.0
how can i get the output....let say..i want 10.3
how can i do that?
and..how can i get input from user?
in others words,the programme prompt and ask the user to give the weight
thanks for helping me~