Respuesta :

Answer:

import java.util.*;

class seconds

{

public static void main (String[] args)

{

    Scanner takeinput=new Scanner(System.in);//creating a scanner object for taking input.

    int hour,min,sec; //declaring 3 variables for hour , minutes and seconds.

    System.out.println("enter hours");

    hour=takeinput.nextInt();//taking input of hours..

    System.out.println("enter minutes");

    min=takeinput.nextInt();//taking input of minutes..

    System.out.println("enter seconds");

    sec=takeinput.nextInt();//taking input of seconds..

    int tot_time_sec=(hour*60*60)+(min*60)+sec; //calculating time in seconds in variable tot_time_sec.

    System.out.println("Total time in seconds is "+tot_time_sec);//pritning total time in seconds..

}

}

For input:

7

20

45

Output is:-

Total time in seconds is 26445..

Explanation:

Above is the code for finding the time in seconds.I have taken three integer variables hour,min and sec for taking input of hours ,minutes and seconds. After taking input i have taken an integer variable tot_time_sec to store the calculated time in seconds and after that printing tot_time_sec.

Following are the program to convert the time into seconds:

Program:import java.util.*;//import packagepublic class Main//

defining a class Main{ public static void main(String[] args)//

defining main method { int h,m,s;//

defining integer variable Scanner sx = new Scanner(System.in);//

Creating the Scanner class object System.out.print("Enter number of hours: ");//

print message h = sx.nextInt();//

input value System.out.print("Enter number of minutes: ");//

print message m = sx.nextInt();//

input value System.out.print("Enter number of seconds: ");//

print message s = sx.nextInt();//input value s = s + m * 60 + h*60*60;//

converting the input value and store its value into s System.out.println("Total number of seconds is "+s);//print value with message }}Program

Import pacake

Defining a class "Main." Inside the class defining the main method.

Inside the main method three integer variable "h,m, and s" is declared that input value from the user-end.

After input, the value from the user end the "s" variable is used that converts the input value into the second then prints the value ith the message.

Find out more information about the java program here:

brainly.com/question/2266606