This question already has an answer here:
I have homework for summer and there's this exercise I can't complete. I have to generate a random hour (HH:MM:SS) and then transform it into seconds. I searched on the internet but everyone was suggesting creating an object and then something like this int mins = rand.nextInt(59) + 0;
but I cant do it in the Class so what should I do?
Methods:
public int randomHour(int myhour,int myminutes,int myseconds){
this.ore=myhour;
this.minuti=myminutes;
this.secondi=myseconds;
return myhour + myminutes + myseconds;
and
public int countSeconds(int totseconds){
totseconds=totseconds;
totseconds = seconds + (60*minuti) + (3600*ore);
return totseconds;
Aucun commentaire:
Enregistrer un commentaire