Advertisement
TiesTienhoven

Untitled

Oct 1st, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner reader = new Scanner(System.in);
  6. BoundedCounter seconds = new BoundedCounter(59);
  7. BoundedCounter minutes = new BoundedCounter(59);
  8. BoundedCounter hours = new BoundedCounter(23);
  9.  
  10. System.out.print("seconds: ");
  11. int s = Integer.parseInt(reader.next());
  12. System.out.print("minutes: ");
  13. int m = Integer.parseInt(reader.next());
  14. System.out.print("hours: ");
  15. int h = Integer.parseInt(reader.next());
  16.  
  17. seconds.setValue(s);
  18. minutes.setValue(m);
  19. hours.setValue(h);
  20.  
  21. int i = 0;
  22. while ( i < 121 ) {
  23. System.out.println(hours + ":" + minutes + ":" + seconds);
  24. seconds.next();
  25. if (seconds.getValue() == 0) {
  26. minutes.next();
  27. if (minutes.getValue() == 0){
  28. hours.next();
  29. }
  30. }
  31.  
  32. i++;
  33. }
  34.  
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement