1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alenkasestr [34]
2 years ago
13

Write a java program that prompts the user to input the elapsed time for an event in hours, minutes, and seconds. The program th

en outputs the elapsed time in seconds.
Computers and Technology
1 answer:
Arisa [49]2 years ago
6 0

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.

You might be interested in
As a technical support rep, michael is responding to a customer's question sent to him via e-mail. what should michael's first t
hoa [83]

As a technical support rep, Michael's first task will be option b: Determine the purpose of the message he will send as a response.

<h3>Who is a technical support rep?</h3>

The role or duty of a Technical Support is known to be any person that tends to troubleshoot customer tech issues.

Note that they are said to be people who often resolve issues that are linked to computers, phones, tablets, and others.

Therefore, As a technical support rep, Michael's first task will be option b: Determine the purpose of the message he will send as a response.

Learn more about technical support  from

brainly.com/question/27366294
#SPJ1

See option

a. conduct any necessary research

b. determine the purpose of the message he will send as a response

c. Hit the "reply" button

d. start composing his reply

7 0
1 year ago
What is the most efficient way to include a space after each paragraph
3241004551 [841]

To skip a line, then write the rest like this!


See? Good spacing, right?

4 0
3 years ago
What word describes a violation of copyright laws? What rights do copyright holders have over their work of art
lesya [120]

breech

malefaction

misdoing

offence

transgression

8 0
3 years ago
Read 2 more answers
If a website ends with .gov does it mean that its written by the government or?
Soloha48 [4]
Umm... No. (I'm pretty sure)
7 0
3 years ago
Read 2 more answers
Create a function named first_a that uses a list comprehension. The function will take a single integer parameter n. Find every
aivan3 [116]

Answer:

def first_a(n):

   lst1 =[x for x in range(1,n+1)if x%6==0 or x%11 ==0]

   print(lst1)

Explanation:

Above is a function in python programming language. We have used list comprehension to check numbers that are multiples of 6 or 11 in a range.

When this function is called it will receive an argument (n) of type integer, a range will then be generated from 1 to n+1 since n is inclusive. The modulo operator is used to determine is a value is a multiple of 6 or 11, since their multiples will evaluate to 0

3 0
3 years ago
Other questions:
  • The term composite would be used to describe an image that was altered by the Crop tool.
    15·1 answer
  • Earthquakes with magnitudes between 1.0 and 2.9 on the Richter scale are
    11·1 answer
  • What is A/B Testing
    10·2 answers
  • What describes the basic transaction data such as its date, purpose, and amount and includes cash receipts, canceled checks, inv
    13·1 answer
  • Which of the following is the code of acceptable behaviors users should follow while on the Internet; that is, it is the conduct
    15·1 answer
  • Assume variables SimpleWriter out and int n are already declared in each case. Write a while loop that printsA. All squares less
    11·1 answer
  • Coding 5 - Classes The Item class is defined for you. See the bottom of the file to see how we will run the code. Define a class
    13·1 answer
  • HELP FAST PLEASE
    6·1 answer
  • In addition to reduced power consumption, what is an advantage of using hyperscale cloud computing data centers?
    8·1 answer
  • In your own words, what is Cryptocurrency?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!