Computer Science, asked by Nivvee, 9 months ago

Write a program in Java that accepts the seconds as input and converts them into the corresponding number of hours,minutes and seconds.

Answers

Answered by Anonymous
1

Java is located in the South East of Asia.It is a famous island in Indonesia which produces rice. It was once densely covered with forests.Indonesia was under the colonial rule of the Dutch. Forest laws were enacted in Java.Villagers were restricted access to the forests. The villagers of java rebelled against the Dutch. Forests in Java had undergone deforestation under the colonial rule.

&lt;!DOCTYPE html&gt;</p><p></p><p>&lt;html lang="en"&gt;</p><p></p><p>&lt;head&gt;</p><p></p><p>&lt;meta charset="UTF-8"&gt;</p><p></p><p>&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;</p><p></p><p>&lt;title&gt;Arc reacter&lt;/title&gt;</p><p></p><p>&lt;link rel="stylesheet" href="design.css" /&gt;</p><p></p><p>&lt;/head&gt;</p><p></p><p></p><p>&lt;body&gt;</p><p></p><p>&lt;div class="fullpage-wrapper"&gt;</p><p></p><p>&lt;div class="reactor-container"&gt;</p><p></p><p>&lt;div class="reactor-container-inner circle abs-center"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="tunnel circle abs-center"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="core-wrapper circle abs-center"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="core-outer circle abs-center"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="core-inner circle abs-center"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil-container"&gt;</p><p></p><p>&lt;div class="coil coil-1"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-2"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-3"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-4"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-5"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-6"&gt;&lt;/div&gt;</p><p>&lt;div class="coil coil-7"&gt;&lt;/div&gt;</p><p></p><p>&lt;div class="coil coil-8"&gt;&lt;/div&gt;</p><p></p><p>&lt;/div&gt;</p><p></p><p>&lt;/div&gt;</p><p></p><p>&lt;/div&gt;</p><p></p><p>&lt;style&gt;</p><p></p><p>body { margin: 0; } .fullpage-wrapper { width: 100%; height: 100vh; background: radial-gradient(#353c44, #222931); display: flex; } .reactor-container { width: 300px; height: 300px; margin: auto; border: 1pxdashed #888; position: relative; border-radius: 50%; background-color: #384c50; border: 1px solid rgb(18, 20, 20); box-shadow: 0px 0px 32px 8px rgb(18, 20, 20), 0px 0px 4px 1px rgb(18, 20, 20) inset; } .reactor-container-inner { height: 238px; width: 238px; background-color: rgb(22, 26, 27);; box-shadow: 0px 0px 4px 1px #52FEFE; } .circle { border-radius: 50%; } .abs-center { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; } .core-inner { width: 70px; height: 70px; border: 5px solid #1B4E5F; background-color: #FFFFFF; box-shadow: 0px 0px 7px 5px #52FEFE, 0px 0px 10px 10px #52FEFE inset; } .core-outer { width: 120px; height: 120px; border: 1px solid #52FEFE; background-color: #FFFFFF; box-shadow: 0px 0px 2px 1px #52FEFE, 0px 0px 10px 5px #52FEFE inset; } .core-wrapper { width: 180px; height: 180px; background-color: #073c4b; box-shadow: 0px 0px 5px 4px</p><p>#52FEFE, 0px 0px 6px 2px #52FEFE inset; } .tunnel { width: 220px; height: 220px; background-color: #FFFFFF; box-shadow: 0px 0px 5px 1px #52FEFE, 0px 0px 5px 4px #52FEFE inset; } .coil-container { position: relative; width: 100%; height: 100%; animation: 3s infinite linear reactor-anim; } .coil { position: absolute; width: 30px; height: 20px; top: calc(50% - 110px); left: calc(50% - 15px); transform-origin: 15px 110px; background-color:#073c4b; box-shadow: 0px 0px 5px #52FEFE inset; } .coil-1 { transform: rotate(0deg); } .coil-2 { transform: rotate(45deg); } .coil-3 { transform: rotate(90deg); } .coil-4 { transform: rotate(135deg); } .coil-5 { transform: rotate(180deg); } .coil-6 { transform: rotate(225deg); } .coil-7 { transform: rotate(270deg); } .coil-8 { transform: rotate(315deg); } @keyframes reactor-anim { from { transform: rotate(0deg); } to { transform: rotate(3600deg); } }</p><p></p><p>&lt;/style&gt;</p><p></p><p>&lt;/body&gt;</p><p></p><p>&lt;/html&gt;

Answered by moonlightmail786
6

Convert seconds to hours, minutes and seconds in java

import java.util.Scanner; public class SecondstoHrMinSec { public static void main(String[] args) { // create object of scanner class. Scanner in = new Scanner(System.in); // enter the seconds here. System.out.print("Enter seconds : "); int seconds = in.nextInt(); int p1 = seconds % 60; int p2 = seconds / 60; int p3 = p2 % 60; p2 = p2 / 60; System.out.print("HH:MM:SS - " +p2 + ":" + p3 + ":" + p1); System.out.print("\n");

Given seconds and we have to convert it into hours, minutes and seconds using java program.

Example:

Input: Input seconds: 6530 Output: HH:MM:SS - 1:48:50 Test: Convert HH:MM:SS to seconds again, 1*60*60 + 48*60 + 50 = 3660 + 2880 + 50 = 6530

Similar questions