yanivtamari

targil clock main

Jun 2nd, 2019
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner s = new Scanner(System.in);
  7.         Clock c1 = new Clock();
  8.         boolean res;
  9.         do {
  10.             System.out.println("enter second");
  11.             res = c1.setSecond(s.nextInt());
  12.         } while (res != true);
  13.         do {
  14.             System.out.println("enter minute");
  15.             res = c1.setMinute(s.nextInt());
  16.         } while (res != true);
  17.         do {
  18.             System.out.println("enter hours");
  19.             res = c1.setHours(s.nextInt());
  20.         } while (res != true);
  21.  
  22.         c1.show();
  23.         System.out.println("the hour is: " + c1.getHours() + ":" + c1.getMinute() + ":" + c1.getSecond());
  24.         c1.tick();
  25.         System.out.println("add 2 second and now the hour is: " + c1.getHours() + ":" + c1.getMinute() + ":" + c1.getSecond());
  26.         c1.reset();
  27.         System.out.println("we reset the clock and now the hour is: " + c1.getHours() + "0:" + c1.getMinute() + "0:" + c1.getSecond() + "0");
  28.  
  29.     }
  30. }
Add Comment
Please, Sign In to add comment