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]
2 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]2 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
What are dividends? AA small part, or share, of a company. BA type of savings account that grows over time. CA distribution of a
Anvisha [2.4K]
Dividends are a distribution of a small percentage of profits to shareholders.
8 0
3 years ago
Which of the following is a good conductor of electricity and heat?
Zarrin [17]
The answer is A metal
7 0
2 years ago
Read 2 more answers
Wow that funny a heck
lorasvet [3.4K]

Answer:

Seriously??? Omg - Orange Trump!!

3 0
2 years ago
Write a CashRegister class that can be used with the RetailItem class that you wrote in Chapter 6's Programming Challenge 4. The
lys-0071 [83]

Answer:

Following are the code to this question:

import java.util.*; //import package for user input

class RetailItem//defining class RetailItem  

{

private String desc;//defining String variable

private int unit;//defining integer variable

private double prices;//defining double variable

RetailItem()//defining default Constructor

{

   //Constructor body

}

Output:

The Sub Total value: 199.75

The Sales Tax value: 11.985

The Total value: $211.735

Explanation:

In the above code three class "RetailItem, CashRegister, and Main" is defined, in the class "RetailItem", it defines three variable that is "desc, unit, and prices", inside the class "get and set" method and the constructor is defined, that calculates its value.

In the next step,  class "CashRegister" is defined, and inside the class parameterized constructor is defined, which uses the get and set method to return its value.  

In the next step, the main class is declared, in the main method two-class object is created and calls its method that are "getSubtotal, getTax, and getTotal".  

There is some technical error that's why full code can't be added so, please find the attached file of code.  

7 0
2 years ago
____ port is a connection in which eight data lines transmit an entire byte of data at one moment in time.
yarga [219]
Hi!

This is going to be a <em>parallel </em>port. It <span>can send various bits of data concurrently using multiple data lines. 

Hopefully, this helps! =)</span>
4 0
3 years ago
Other questions:
  • _____ view focuses on the text and content of a document, without much information on the page layout
    15·1 answer
  • ____________ is a widely accepted international best practices framework for implementing information systems security.
    12·1 answer
  • Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per li
    11·1 answer
  • Which federal agency enforces safety and health legislation and requires employers to be sure that adequate first-aid supplies a
    5·1 answer
  • Normalization works through a series of stages called normal forms. For most purposes in business database design, _____ stages
    7·2 answers
  • I'm in Paris and want to take a picture of my mom in front of the Eifel Tower. I want both her and the tower to be in sharp focu
    14·2 answers
  • What would be a social networking page background for Sigmund Freud?
    15·1 answer
  • The Ocean Medallion is a wearable device that connects virtually to various devices on board a cruise ship. When a guest is wear
    14·1 answer
  • Difine the term pigment​
    14·3 answers
  • Structured query language (sql) enables data analysts to _____ the information in a database.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!