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 s = new Scanner(System.in);
- Clock c1 = new Clock();
- boolean res;
- do {
- System.out.println("enter second");
- res = c1.setSecond(s.nextInt());
- } while (res != true);
- do {
- System.out.println("enter minute");
- res = c1.setMinute(s.nextInt());
- } while (res != true);
- do {
- System.out.println("enter hours");
- res = c1.setHours(s.nextInt());
- } while (res != true);
- c1.show();
- System.out.println("the hour is: " + c1.getHours() + ":" + c1.getMinute() + ":" + c1.getSecond());
- c1.tick();
- System.out.println("add 2 second and now the hour is: " + c1.getHours() + ":" + c1.getMinute() + ":" + c1.getSecond());
- c1.reset();
- System.out.println("we reset the clock and now the hour is: " + c1.getHours() + "0:" + c1.getMinute() + "0:" + c1.getSecond() + "0");
- }
- }
Add Comment
Please, Sign In to add comment