Seconds left in the day
Calculationunknown
java
2 years ago
804 B
9
Indexable
package javaProject; import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { System.out.println("What hour is it?"); Scanner sc = new Scanner(System.in); String Hour = sc.nextLine(); System.out.println("What minute is it?"); Scanner sc2 = new Scanner(System.in); String Minutes = sc2.nextLine(); System.out.println("How many seconds?"); Scanner sc3 = new Scanner(System.in); String Seconds = sc3.nextLine(); int a=Integer.parseInt(Hour); int b=Integer.parseInt(Minutes); int c=Integer.parseInt(Seconds); int HourToSec = a * 3600; int MinToSec = b * 60; System.out.print("There are "); System.out.print( 86400 - HourToSec + MinToSec + c); System.out.print(" seconds left in the day."); } }
Editor is loading...