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
miskamm [114]
3 years ago
15

Write a program that estimates how many years, months, weeks, days, and hours have gone by since Jan 1 1970 by calculations with

the number of seconds that have passed.
Computers and Technology
1 answer:
Rzqust [24]3 years ago
6 0

Answer:

Explanation:

The following code is written in Java. It uses the LocalDate import to get the number of seconds since the epoch (Jan 1, 1970) and then uses the ChronoUnit import class to transform those seconds into years, months, weeks days, and hours. Finally, printing out each value separately to the console. The output of the code can be seen in the attached picture below.

import java.time.LocalDate;

import java.time.temporal.ChronoUnit;

class Brainly {

   public static void main(String[] args) {

       LocalDate now = LocalDate.now();

       LocalDate epoch = LocalDate.ofEpochDay(0);

       System.out.println("Time since Jan 1 1970");

       System.out.println("Years: " + ChronoUnit.YEARS.between(epoch, now));

       System.out.println("Months: " + ChronoUnit.MONTHS.between(epoch, now));

       System.out.println("Weeks: " + ChronoUnit.WEEKS.between(epoch, now));

       System.out.println("Days: " + ChronoUnit.DAYS.between(epoch, now));

       System.out.println("Hours: " + (ChronoUnit.DAYS.between(epoch, now) * 24));    

   }

}

You might be interested in
Define a class named ComparableSquare that extends Square (defined above) and implements Comparable. Implement the compareTo met
Alexxx [7]

Answer:

/*********************************************************************************

* (The ComparableCircle class) Define a class named ComparableCircle that        *

* extends Circle and implements Comparable. Draw the UML diagram and implement   *

* the compareTo method to compare the circles on the basis of area. Write a test *

* class to find the larger of two instances of ComparableCircle objects.         *

*********************************************************************************/

public class Exercise_13_06 {

/** Main method */

public static void main(String[] args) {

 // Create two instances of ComparableCircle objects

 ComparableCircle comparableCircle1 = new ComparableCircle(12.5);

 ComparableCircle comparableCircle2 = new ComparableCircle(18.3);

 // Display comparableCircles

 System.out.println("\nComparableCircle1:");

 System.out.println(comparableCircle1);

 System.out.println("\nComparableCircle2:");

 System.out.println(comparableCircle2);

 // Find and display the larger of the two ComparableCircle objects

 System.out.println((comparableCircle1.compareTo(comparableCircle2) == 1  

  ? "\nComparableCircle1 " : "\nComparableCircle2 ") +  

  "is the larger of the two Circles");

}

}

3 0
3 years ago
16
Lubov Fominskaja [6]
16
is a built-in mathematical formula included in MS Excel,
A) Function
4 0
3 years ago
Order the steps for accessing the junk email options in outlook 2016
Zinaida [17]

Answer:

What is the question here? lol

Explanation:

8 0
4 years ago
A(n ____________ is considered a named collection of bytes having persistent or lasting storage.
kykrilka [37]
A(n) file is considered a named collection of bytes having persistent or lasting storage.
6 0
3 years ago
Alicia uses a software application to store the names, email addresses, and phone numbers of her friends in alphabetical order. 
Romashka-Z-Leto [24]

I'm not 100% sure but I think it might be Microsoft excel.... correct me if I'm wrong

7 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following are features of the HTTPS protocol?
    6·1 answer
  • What protocol must be supported by routers in order to utilize remote assistance easy connect?
    10·1 answer
  • A prime number is a number that is only evenly divisble by itself and 1.
    12·1 answer
  • When parallel sections of oxygen and fuel gas hoses are taped together, only _____ inches out of 12 inches should be covered by
    8·2 answers
  • Which of the following is the easiest way for visitors to learn about a business while visiting a website?
    13·1 answer
  • In a company you are in charge of system maintainance. Justify with 5 reasons why your role is key
    6·1 answer
  • Java Eclipse homework. I need help coding this
    6·1 answer
  • FCAPS is a network management functional model. FCAPS is an acronym that represents the focal tasks necessary to effectively man
    13·1 answer
  • Explain why it is wise to memorize your social security number.
    7·1 answer
  • A ____ attack is much more substantial than a dos attack because of the use of multiple systems to simultaneously attack a singl
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!