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
write an application to presell a limited number of cinema tickets. each buyer can buy as many as 4 tickets. No more than 100 ti
Rus_ich [418]

Answer:

The program for this question can be given as:

Program:

import java.util.*;  //import package

public class TicketSeller  //define class

{

public static void main(String ar[])  //main method

{

int totalTickets=100,userCount=0,remainingTickets=100,numTickets; // varaibale

try           //try block

{

Scanner ob= new Scanner(System.in);  //input by user

System.out.println("Total Tickets:"+totalTickets);

while(remainingTickets!=0)          //loop

{

System.out.print("Enter no of Tickets to buy:");      //message.

numTickets=ob.nextInt(); //taking input

if(numTickets<=4)         //conditional statements.

{

if(remainingTickets>=numTickets)

{

remainingTickets=remainingTickets-numTickets;              //calculate remainingTickets

userCount++;

System.out.println("remaining tickets : "+remainingTickets+" user :"+userCount);      

}

else

{

System.out.println("Invalid Input");

}

}

else

{

System.out.println("Invalid Input");

}

}

}

catch(Exception e)            //catch block.

{

}

}

}

Output:

Total tickets:100

Enter no of Tickets to buy: 4

Remaining tickets : 96 User :1

Enter no of Tickets to buy: 4

Remaining tickets : 92 User :2

Enter no of Tickets to buy: 4

Remaining tickets : 88 User :3

.

.

.

Enter no of Tickets to buy: 4

Remaining tickets : 0 User :25

Explanation:

In the above Program firstly we import the package for the user input. Then we declare the class that is (TicketSeller) given in question. In this class we declare the main method in the main method we declare the variable that is totalTickets, userCount, remainingTickets and numTickets .Then we use the exception handling. we use this for providing the validation from the user side that users don't insert value less the 4. In the exception handling, we use the multiple catch block with try block. Then we input from the user and calculate the values and in the last, we print all the values.

8 0
3 years ago
Which of the following image file formats uses lossy file compression?
enyata [817]

Answer:

JPEG

Explanation:

5 0
3 years ago
Which of the following solutions enables simultaneous digital transmission of voice, video, data, and other network services ove
Annette [7]

Answer:

3. ISDN

Explanation:

ISDN ( Integrated Services Digital Network  ) -

It is the used for the simultaneous digital transmission of network service , data , video and voice , instead of the old circuits of the public switched telephone network ( PSTN ) , is referred to as ISDN .

The characteristic feature of ISDN is that it integrates the data and speech on the same lines , which is not possible in PSTN .

Hence, from the given information of the question,

The correct option is ISDN .

8 0
2 years ago
Examination of Internet records in order to reveal the identity of an anonymous poster is defined as
Sergeu [11.5K]

Answer: Doxing

Explanation: Doxing which is also referred as doxxing is defined as the revealing or publishing of the private records or information to the public.It is considered as the illegal practice which is base on the the internet service.The publicizing of the private data or confidential information is punishable offence.

Other options are incorrect because filtering is the elimination of the not required content, spamming is the activity of sending undesired bulk messages and hacking is the attacking of the system using false means to corrupt and steal data.Thus the correct option is doxing.

6 0
3 years ago
Look at the logic program below. Set a breakpoint after each commented instruction. You can also single step through the program
Goshia [24]

Using programming knowledge, it is possible to use programming logic, we can differentiate and find the terms

<h3>Writing the code and understanding the programming logic:</h3>

<em>.data</em>

<em>sourceword:</em>

<em>.word 0xAB</em>

<em>wordmask:</em>

<em>.word 0xCF</em>

<em>operand:</em>

<em>.long 0xAA</em>

<em>.text</em>

<em>.globl _start</em>

<em>_start:</em>

<em>movw sourceword, %ax # ax=0x00AB ( move the word value of sourceword =0x00AB to ax register.)</em>

<em>movw %ax, %bx # bx=0x00AB ( copy the value of ax to bx register.)</em>

<em>xorw %cx, %cx # cx=0000 ( cx=cx XOR cx, that is clear cx register.)</em>

<em />

<em>andw wordmask, %ax # ax=0x008B ( ax=ax AND wordmask= 0x00AB AND 0x00CF= 0x008B)</em>

<em>orw wordmask, %bx # bx=0x00EF (bx=bx OR wordmask= 0x00AB OR 0x00CF= 0x00EF.)</em>

<em>xorw wordmask, %cx # cx=0x00CF (cx=cx XOR wordmask= 0x0000 XOR 0x00CF=0x00CF.)</em>

<em />

<em>movl operand, %eax # eax=0x000000AA. ( copy the 32-bit value of operand=0x000000AA to eax.)</em>

<em>movl %eax, %ebx # ebx=0x000000AA.( copy the value of eax to ebx.)</em>

<em>movl %eax, %ecx # ecx=0x000000AA. ( copy the value of eax to ecx.)</em>

<em />

<em>shll $3,%eax # eax=0x00000550. ( logical shift left of eax=0x000000AA by 3 bits.)</em>

<em />

<em># 0x000000AA=00000000000000000000000010101010</em>

<em />

<em># =>00000000000000000000010101010000=0x00000550.</em>

<em />

<em>rorl $4,%ebx # ebx=0xA000000A. (Rotate right ebx=0x000000AA by 4 bits.)</em>

<em />

<em># 0x000000AA=00000000000000000000000010101010</em>

<em />

<em>3 =>10100000000000000000000000001010= 0xA000000A.</em>

<em />

<em>sarl %ecx # here the count value to shift the bits not mentioned.</em>

<em />

<em># It is the arithmetic shift right instruction. the shifted left bits filled with MSB bit.</em>

See more about logic program at brainly.com/question/14970713

#SPJ1

5 0
2 years ago
Other questions:
  • To create an individual version of a slide, you would click
    9·1 answer
  • Which of the following describes a hash algorithms ability to avoid the same output from two guessed inputs?A. Collision avoidan
    12·1 answer
  • What inventor patented the first American movie projector?
    14·2 answers
  • There are ways to perform computer commands quickly and multiple times. <br> a. True <br> b. False
    11·2 answers
  • In which type of land contract does the seller earn interest on the difference between what the seller owes on an existing loan
    14·1 answer
  • On laptops, wireless cards tend to be attached to which panel?
    8·1 answer
  • We have written a method called sum with an int[] parameter nums. We want our sum method to compute the sum of nums, but our cod
    5·1 answer
  • Which component of a word processor displays the name of the document?
    13·1 answer
  • What type of network would be suitable for linking all computers in a building
    6·1 answer
  • Gn guys have an Amazing day!
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!