Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner reader = new Scanner(System.in);
- BoundedCounter seconds = new BoundedCounter(59);
- BoundedCounter minutes = new BoundedCounter(59);
- BoundedCounter hours = new BoundedCounter(23);
- System.out.print("seconds: ");
- int s = Integer.parseInt(reader.next());
- System.out.print("minutes: ");
- int m = Integer.parseInt(reader.next());
- System.out.print("hours: ");
- int h = Integer.parseInt(reader.next());
- seconds.setValue(s);
- minutes.setValue(m);
- hours.setValue(h);
- int i = 0;
- while ( i < 121 ) {
- System.out.println(hours + ":" + minutes + ":" + seconds);
- seconds.next();
- if (seconds.getValue() == 0) {
- minutes.next();
- if (minutes.getValue() == 0){
- hours.next();
- }
- }
- i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement