hey everyone,
I've tried this basic piece of javacode.I use bluej to compile and test this.
The basics are very simple: seconds,minutes and hours that you can fill in yourself. But When you put in a number larger then 60 in the seconds part or smaller then 0,the value should automatically be 0. But when you test this one and for example insert 5000,it doesn't change to 0. I've pasted the code underneath.
public class Tijd{
private int sec;
private int min;
private int uur;
public Tijd(int sec, int min, int uur) {
this.setSec(sec);
this.setMin(min);
this.setUur(uur);
}
public int getSec() {
return sec; }
public int getMin() {
return min; }
public int getUur() {
return uur; }
public void setSec(int sec) {
if(this.sec>60) {
this.setSec(0); }
if(this.sec<0) {
this.setSec(0);}
this.sec=sec;}
public void setMin(int min) {
this.min=min; }
public void setUur(int uur) {
this.uur=uur; }
public void reSet() {
this.uur=0;
this.min=0;
this.sec=0; }
}

