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
pantera1 [17]
3 years ago
15

Write a method that converts a time given in seconds to hours, minutes and seconds using the following header:

Computers and Technology
1 answer:
garik1379 [7]3 years ago
6 0

Answer:

hope this helps.

Explanation:

import java.util.*;

class Timeconvert{ //class nane

public static String convertTime(int totalSeconds) /* fn to convert seconds to hh:mm:ss format */

{

int sec = totalSeconds; // a copy of totalSeconds is stored in sec

int m=sec/60; //to find the total min which obtained by doing sec/60

int psec=sec%60; //psec store remaining seconds

int hrs=m/60; //stores hr value obtained by doing m/60

int min=m%60; //stores min value obtained by m%60

return (hrs + ":" + min+ ":" +psec);// returning that string

}

}

public class Main

{

  public static void main(String[] args) {

  Timeconvert t = new Timeconvert();

  Scanner in = new Scanner(System.in); //Scanner class

System.out.println("Enter the number of seconds:");

int sec = in.nextInt(); //to input number of seconds

System.out.println("hours:minutes:seconds is " + t.convertTime(sec)); //result

 

  }

}

You might be interested in
Which question is most closely related to the field of biology? A.How thick is a paper bag? B.What determines the growth rate of
Andrei [34K]
B. What determines the growth rate of a fish population
6 0
4 years ago
Read 2 more answers
Look at the graph. What is the meaning of the point shown with a star
RUDIKE [14]
The answer is B. 1 Box= 1/2 Pounds
4 0
3 years ago
The page-replacement policy means that pages are not placed to make more space. A. True B. False
BabaBlast [244]

Answer:

B. False

Explanation:

A page-replacement policy can be defined as a set of algorithm that instructs the operating systems on what memory page is to be swapped, paged out or written to disk in order to allocate more memory as they're required by various active processes during virtual memory management.

Some of the algorithms or techniques used by the operating system for page-replacement policy are;

1. Last In First Out (LIFO).

2. First In First Out (FIFO).

3. Least Recently Used (LRU).

4. Least Frequently Used (LFU).

5. Optimal (OPT or MIN).

Hence, the page-replacement policy means that pages are placed to make more space and to minimize the total number of page that would be missing.

7 0
3 years ago
Which employees work directly with customers, helping them make deposits and withdrawals?
d1i1m1o1n [39]
I believe the answer is customer service
5 0
3 years ago
Read 2 more answers
Unlike clip art, you cannot resize a photograph using the mouse. <br> a. True<br> b. False
masya89 [10]
<span>b. false; unlike clip art, you cannot resize a photograph

</span>
7 0
3 years ago
Other questions:
  • A(n) ______ database stores data in tables that consist of rows and columns.
    5·2 answers
  • What is difference between actual parameters and formal parameters in java?​
    8·2 answers
  • Most smartphones use operating systems developed by ________.
    10·1 answer
  • What are the six critical components of an information system? Select three of the six components, and describe a potential vuln
    15·1 answer
  • 20 points
    5·1 answer
  • Hannah wanted to watch a movie. She typed the movie name on the search engine. In result she found the downloadable link of the
    10·1 answer
  • What errors does the grammar tool find? Choose all that apply
    11·1 answer
  • If you are to enhance the ICT used by your teachers, how will ypu do it? Will you use the same ICT or will you modify how it was
    11·1 answer
  • I need this answered
    10·1 answer
  • Name the two additional tabs that appear on selecting a chart​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!