Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

what is a simple java countdown timing (in second) code which my program is look

ID: 668939 • Letter: W

Question

what is a simple java countdown timing (in second) code

which my program is look like :

public class time {
public static void main(String[] args) {
long now = System.currentTimeMillis()/1000;
// The problem will occur at 2^31 seconds
long year38 = (long) Math.pow(2, 31);
long days = (year38- now)/ 86400;
long hours = (year38 - now)/3600)/;
long minutes = (year38 - now) /60;
long seconds =(year38-now);
System.out.printf(
" %d days " +
" %d hours "+
" %d minutes " +
" %d seconds ", (int)days, hours, minutes, seconds);
}

}

Explanation / Answer

import java.util.Scanner;
public class Time
{
public static void main(String[] args) throws InterruptedException
{
Scanner scan = new Scanner(System.in);
System.out.println("time (In Minutes)");
int timet= scan.nextInt() * 60; //This is used to convert to seconds
long delay = timet * 1000;
do
{
int minutes = timet / 60;
int seconds = timet % 60;
System.out.println(minutes +" minute(s), " + seconds + " second(s)");
Thread.sleep(1000);
timet = timet - 1;
delay = delay - 1000;
}
while (delay != 0);
System.out.println("Time Up!");
}
}