Computers and Technology, 25.04.2020 00:28, kaya1523
Consider the method get Hours, which is intended to calculate the number of hours that a vehicle takes to travel between two mile markers on a highway if the vehicle travels at a constant speed of 60 miles per hour. A mile marker is a sign showing the number of miles along a road between some fixed location (for example, the beginning of a highway) and the current location.
The following table shows two examples of the intended behavior of getHours, based on the int parameters marker1 and marker2.
marker1 marker2 Return Value
100 220 2.0
100 70 0.5
Consider the following implementation of getHours.
public static double getHours (int marker1, marker2)
{
/* missing statement */
return hours;
}
1. Which of the following statements can replace /* missing statement */ so getHours works as intended?
(A) double hours = (Math. abs (marker1) - Math. abs (marker2)) / 60.0;
(B) double hours = Math. abs (marker1 - marker2 / 60.0)
(C) double hours = Math. abs (marker1 - marker2) / 60.
(D) double hours = Math. abs((marker1 - marker2) / 60);
(E) double hours = (double) (Math. abs (marker1 - marker2) / 60);
Answers: 2
Computers and Technology, 23.06.2019 07:30, cireland
Write a program that inserts the digits of an integer into an array in originalorderfollowed by reverse order. first, promptthe user to enter a positive integer(> 0). determine the number of digits of the integer. create a dynamically allocated integer arrayof a size twice the number of digits. now insert the digits in original order which will occupy half of the array. then, insert the digits in reverse order. finally, output thedigits in thearray. use at least two functions to organize your program.
Answers: 3
Consider the method get Hours, which is intended to calculate the number of hours that a vehicle tak...
English, 26.01.2021 22:10