Using the knowledge in computational language in JAVA it is possible to write a code that user calls this method to advance the clock by one second. When the seconds value reaches 60, it rolls over to zero.
public class Time
{
private int hours;
private int minutes;
private int seconds;
public void advanceOneSecond()
{
seconds++;
if(seconds >= 60)
{
seconds -= 60;
minutes++;
}
if(minutes >= 60)
{
minutes -= 60;
hours++;
}
if(hours >= 24)
hours -= 24;
}
public int compareTo(Time otherTime)
{
if(hours > otherTime.hours)
return 1;
else if(hours < otherTime.hours)
return -1;
else
{
if(minutes > otherTime.minutes)
return 1;
else if(minutes < otherTime.minutes)
return -1;
else
{
if(seconds > otherTime.seconds)
return 1;
else if(seconds < otherTime.seconds)
return -1;
else
return 0;
}
}
}
public void add(Time offset)
{
seconds += offset.seconds;
minutes += offset.minutes;
hours += offset.hours;
if(seconds >= 60)
{
seconds -= 60;
minutes++;
}
if(minutes >= 60)
{
minutes -= 60;
hours++;
}
if(hours >= 24)
hours -= 24;
}
public void subtract(Time offset)
{
if(offset.seconds > seconds)
{
minutes--;
seconds = seconds + 60;
}
seconds -= offset.seconds;
if(offset.minutes > minutes)
{
hours--;
minutes = minutes + 60;
}
minutes -= offset.minutes;
if(offset.hours > hours)
{
hours += 24;
}
hours -= offset.hours;
}
}
See more about JAVA at brainly.com/question/18502436
#SPJ1
Answer:
ARPANET is the earliest version of the present-day Internet.
Explanation:
ARPANET is the type of network that is used before the Internet in the year 1967. It was advanced in the control of U.S ARPA(Advanced Research Projects Agency). After the year of 1980, it was given to the military network for the protection of the data network but after all, it is for the small area network and the Internet is the World Wide network.
Answer:
He should remove any removable devices from the PC , change the boot device to USB or CD drive and insert the installation disk or a created ISO USB file to install
Explanation:
Answer: the answer is 1
Explanation:
edge 2021
Answer:
Explanation:
We can divide array A into two arrays B , C
B would contain the sorted n elements.
C would contain the unsorted m elements.
Now we can sort C using merge sort with worst time complexity mlogm.
When you will have array C sorted you can concatenate with B and put it back in A.
Answer:
SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC
Explanation:
The table definition is not given;
However, I'll make the following assumptions
Table Name:
Employee
Columns:
Technician name will be represented with Techname
Employee number will be represented with Empnum
Year Hired will be represented with Year
Having said that; the sql code is as follows:
SELECT TECHNAME, EMPNUM, YEAR FROM EMPLOYEE ORDER BY YEAR DESC
The newest year hired will be the largest of the years;
Take for instance:
An employee hired in 2020 is new compared to an employee hired in 2019
This implies that the year has to be sorted in descending order to maintain the from newest to oldest.
Answer:
The open source is the programming language that basically falls inside the parameters of the protocol of open-source convention. This fundamentally implies the language are not proprietary, with the specific arrangements (contingent upon the open source permit), can be adjusted and based upon in a way that is available to general society.
The python and ruby are the main examples of the open source programming language.
The disadvantage of the open source is that it is not much compatible as compared to all other software. It is not user friendly and easy for using the software.
The advantage of the open source programming is that it is available at low cost and it has high availability.