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
Darina [25.2K]
3 years ago
6

Consider the method get Hours, which is intended to calculate the number of hours that a vehicle takes to travel between two mil

e 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. IN The following table shows two examples of the intended behavior of getHours, based on the int parameters markeri and marker2. marker1 marke 100 220 100 700.5 Consider the following implementation of getHours. public static double getHours (int markeri, int ON 20 | 2 15. . . e no E /* missing statement */ return hours; Which of the following statements can replace /* missing statement */ so getHours works as intended?
(A) double hours = (Math.abs (markerl) - Math.abs (marker2)) / 60.0;||
(B) double hours = Math.abs (markeri - marker2 / 60.0)
(C) double hours = Math.abs (marker1 - marker2) / 60.0;
(D) double hours = Math.abs((markeri - marker2) / 60);
(E) double hours = (double) (Math.abs (marker1 - marker2) / 60);
Computers and Technology
1 answer:
mr Goodwill [35]3 years ago
7 0

Answer:

Replace the comment with:

(c) double hours = Math.abs (marker1 - marker2) / 60.0;

Explanation:

See attachment for right presentation of question

Analyzing the options:

(a): May return a negative result

This option will return a negative value if marker1 is less than marker2 because it subtracts the absolute value of marker2 from the absolute value marker1.

This literally is not different from marker1 - marker2

(b): Incorrect expression

This divides only marker2 by 60, then subtracts the quotient from marker1. This is not the expected expression.

(c) This option is correct

This correctly calculate the positive difference between marker1 and marker2 and the result is divided by 60.0 (note 60.0 not 60)

(d) & (e) Integer division

When a variable declared as double is divided by an integer variable or value, the result of the computation is not always accurate due to approximation

You might be interested in
It is 10PM and you are inside in the middle of a large building. Your cell phone is dead so you cannot use wifi or cell signals
kupik [55]

<em>The answer is: your GPS unit cannot send signals to the satellite when it cannot reach it by line of sight. </em>

<em> </em>

<em>GPS signals are based on frequencies that can be blocked by solid objects (like walls and roofs). A GPS device is using a series of satellites to detect and see where it is physically located. These frequencies are sent from these plates (satellites) and we cannot expect it to go through all kinds of barriers. When you use a GPS inside a building, a wide variety of physical barriers and potential interference sources make it difficult for the device to detect your location accurately. </em>

<em> </em>

<em />

4 0
2 years ago
If you’re the victim of cyber bullying behavior, besides contacting your teacher or the school, where else can you go to find in
RideAnS [48]

parents

childline

ceop

family

3 0
3 years ago
An application that allows you to connect to the millions of networks on the Internet is referred to as a(n) _____. Internet bro
storchak [24]
It's called an Internet Browser. Examples include Chrome, Firefox, and Internet Explorer.
4 0
3 years ago
Soldering is a method of
babymother [125]

Answer:

Is a process in which two or more metal items are joined together by melting

Explanation:

: )

4 0
3 years ago
Read 2 more answers
Implement a class that simulates a traffic light. The next function advances the color in the usual way, from green to yellow to
marusya05 [52]

Answer:

Explanation:

The following is written in Java. It creates the trafficLight class which holds the currentLight string variable and a int count variable for the number of times the light has been red. It also contains two constructors one that takes the currentLight as a parameter and one that does not. Finally, it has the next() method which analyzes the currentLight status and changes it to the next light. Output can be seen in the attached picture below.

class Brainly

{

   public static void main(String[] args)

   {

       trafficLight traffic_light = new trafficLight();

       System.out.println("Current Light: " + traffic_light.currentLight);

       traffic_light.next();

       System.out.println("Current Light after change: " + traffic_light.currentLight);

       

   }

}

class trafficLight {

   String currentLight;

   int count = 0;

   public trafficLight(String currentLight) {

       this.currentLight = currentLight;

   }

   public trafficLight() {

       this.currentLight = "red";

       count++;

   }

   public void next() {

       if (this.currentLight == "green") {

           this.currentLight = "yellow";

       } else if (this.currentLight == "yellow") {

           this.currentLight = "red";

           count++;

       } else {

           this.currentLight = "green";

       }

   }

}

7 0
2 years ago
Other questions:
  • .) Write a complete C program in one file which takes a double value from the user, cubes it, and prints the result. Your progra
    10·1 answer
  • The Table Tools tab provides which two additional tabs?
    5·1 answer
  • Which of the following statements is true? Methods and instance variables can both be either public or private. Information hidi
    11·1 answer
  • What is the Default path for SYSVOL?
    14·1 answer
  • What type of culture is computer hardware?
    6·2 answers
  • I need help under standing an assignment, I've contacted my teacher but I want to finish this class already. Here's the directio
    11·1 answer
  • Universal Containers uses a custom object within the product development team. Product development, executives, and System Admin
    11·1 answer
  • Which statement is true?
    13·2 answers
  • An early attempt to force users to use less predictable passwords involved computer-supplied passwords. The passwords were eight
    10·1 answer
  • Pa answer po thank you​
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!