Question: using java language date may be specified by three numbers denoting year, month and day of month. If we don't need dates from a deep
using java language
date may be specified by three numbers denoting year, month and day of month. If we don't need dates from a deep past, we can specify years relative to the year eg year as Assuming that we will not consider the future past the year we can use numbers from the interval for year; such numbers can be written on bits. Month number can occupy bits, as it belongs to the interval and for the day we can spend bits which is enough to store any number from the interval Therefore, full date can be packed in bits and we can store two such dates in one bit int eg beginning and end of a period
Write a program which defines two dates from and to each as three integers year month, day Pack them into one integer. Then unpack the integer and recover these six numbers.
For example, the following programshould print
OriginalFrom to ReconstructedFrom to
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
