Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package class170706;
- import java.util.Scanner;
- public class ClockTester {
- public static void main(String[] args) {
- // create a scanner
- Scanner s = new Scanner(System.in);
- // create a clock
- Clock c1 = new Clock();
- System.out.printf("c1 default values are %s\n", c1);
- // set clock properties
- do {
- System.out.print("Enter hours (0 t0 23): ");
- } while (!c1.setHours(s.nextInt()));
- do {
- System.out.print("Enter minutes (0 to 59): ");
- } while (!c1.setMinutes(s.nextInt()));
- do {
- System.out.print("Enter seconds (0 to 59): ");
- } while (!c1.setSeconds(s.nextInt()));
- System.out.println("\nc1 updated to " + c1);
- // add two seconds
- c1.tick();
- c1.tick();
- System.out.println("\nc1 after two seconds is " + c1);
- // reset
- c1.reset();
- System.out.println("c1 after reset is " + c1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement