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
sleet_krkn [62]
2 years ago
15

Write a program in Java programming language that given two clock times prints out the absolute number of minutes between them

Computers and Technology
1 answer:
Triss [41]2 years ago
7 0

Answer:

// Java Program to Find the difference

// between Two Time Periods

// Importing the Date Class from the util package

import java.util.*;

// Importing the SimpleDateFormat

// Class from the text package

import java.text.*;

public class GFG {

public static void main(String[] args) throws Exception

{

 // Dates to be parsed

 String time1 = "18:00:00";

 String time2 = "7:30:50";

 // Creating a SimpleDateFormat object

 // to parse time in the format HH:MM:SS

 SimpleDateFormat simpleDateFormat

  = new SimpleDateFormat("HH:mm:ss");

 // Parsing the Time Period

 Date date1 = simpleDateFormat.parse(time1);

 Date date2 = simpleDateFormat.parse(time2);

 // Calculating the difference in milliseconds

 long differenceInMilliSeconds

  = Math.abs(date2.getTime() - date1.getTime());

 // Calculating the difference in Hours

 long differenceInHours

  = (differenceInMilliSeconds / (60 * 60 * 1000))

  % 24;

 // Calculating the difference in Minutes

 long differenceInMinutes

  = (differenceInMilliSeconds / (60 * 1000)) % 60;

 // Calculating the difference in Seconds

 long differenceInSeconds

  = (differenceInMilliSeconds / 1000) % 60;

 // Printing the answer

 System.out.println(

  "Difference is " + differenceInHours + " hours "

  + differenceInMinutes + " minutes "

  + differenceInSeconds + " Seconds. ");

}

}

You might be interested in
Classify the functions of dhcp and dns protocols​
Yuki888 [10]

Answer:

Dynamic Host Configuration Protocol (DHCP) enables users to dynamically and transparently assign reusable IP addresses to clients. ... Domain Name System (DNS) is the system in the Internet that maps names of objects (usually host names) into IP numbers or other resource record values.

8 0
3 years ago
Erik is the president and owner of Watch Out, a local website development company that helps clients create and build unique web
11111nata11111 [884]

Answer:

A. Source code

Explanation:

In the field of Programming; Source code is the code written in high level language given to the computer to translate to machine -  executable code before executing. It is usually written and understood by human. It is closer to human like language, as it allows easier expression. It is mostly consist of english-like statement.

So, Erik would primarily be writing source code when performing his daily tasks since his daily task require high level of computer programming and internet knowledge.

5 0
3 years ago
Leo noticed that attackers have breached his wireless network. They seem to have used a brute-force attack on the WiFi protected
kakasveta [241]

Answer:

It is called a WPS brutal force attack.

Explanation:

Wired and wireless networks are both susceptible to attacks. The wired network, the advantage as a cable connection, is more secure than wireless networks, but wireless network also have security measures like the wifi protected set up (WPS).

WPS is used to connect to a network without passphrase, but with a key combination or a PIN.

Brutal force attacks are used on WPS to forcefully generate the PIN, using a third party software.

3 0
3 years ago
Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binar
MAXImum [283]

Answer:

thats what i was about to ask. im not sure

Explanation:

sorry   '-'

3 0
3 years ago
Cell styles can only be applied to the first five columns of a worksheet.<br> a.true<br> b.false
andreyandreev [35.5K]
The correct answer is A true! 
6 0
3 years ago
Read 2 more answers
Other questions:
  • What are the example of dedicated computers?
    5·1 answer
  • Who was the 1st person to use the term television
    11·1 answer
  • What is the difference between a key escrow and a recovery agent? (Choose all that apply.)
    12·1 answer
  • Evolution of computers
    13·2 answers
  • Which type of error is a random error
    13·2 answers
  • Write a Twitter class that sets the Twitter user first (who is to be followed) and lets the client add up to 5 followers, which
    10·1 answer
  • Write a recursive function sumAll that accepts an integer argument and returns the sum of all the integers from 1 up to the numb
    10·1 answer
  • 2. ¿Cuáles de los siguientes Software son lenguajes de Programación?
    10·1 answer
  • Which of these expressions is used to check whether num is equal to value?
    13·1 answer
  • Pleaseeeeeeee tellllllllllllllllllllll​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!