Advertisement
apez1

Term 1: Lesson 32 - Coding Activity 4

Nov 23rd, 2018
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.math.*;
  3.  
  4. public class Lesson_32_Activity_Four {
  5.    
  6.     static Scanner scanner = new Scanner(System.in);
  7.    
  8.     public static void realTime(int input) {
  9.    
  10.     int hours = input / 3600;
  11.     int temp = input - (hours * 3600);
  12.     int minutes = temp / 60;
  13.     temp = temp - (minutes * 60);
  14.     int seconds = temp ;
  15.            
  16.     System.out.println("Hours: " + hours);
  17.     System.out.println("Minutes: " + minutes);
  18.     System.out.println("Seconds: " + seconds);
  19.    
  20.    
  21.     }
  22.    
  23.    
  24.     public static void main(String[] args) {
  25.    
  26.         System.out.println("How many seconds?");
  27.         int input = scanner.nextInt();
  28.  
  29.         realTime(input);
  30.        
  31.  
  32.     }
  33.    
  34.    
  35.    
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement