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
soldi70 [24.7K]
3 years ago
6

A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the following code segment is intended t

o display the minimum length of rope, in feet, that must be purchased so that the rope is long enough to be cut into the three lengths. For example, for lengths of 2.8 feet, 3 feet, and 5 feet, the minimum length of rope that must be purchased is 11 feet. For these inputs, the code segment should display 11. As another example, for lengths of 1.1 feet, 3.2 feet, and 2 feet, the minimum length of rope that must be purchased is 7 feet. For these inputs, the code segment should display 7.
double len1
double len2
double len3;
double total = len1 + len2 + len3
int minLength = (int) (total + 0.5)
System. out. print(minLength)
Which of the following best describes the behavior of the code segment?
A. The code segment works as intended for all non-negative values of len1, len2, and len3.
B. The code segment works as intended but only when the sum of the three lengths is an integer or the decimal part of the sum of the three lengths is greater than or equal to 0.5.
C. The code segment does not work as intended for some values of len1, len2, and len3. It could be corrected by casting len1, len2, and len3 to int before adding them together and assigning the sum to minLength.
D. The code segment does not work as intended for some values of len1, len2, and len3. It could be corrected by declaring minLength as a double and casting it to an int in the System. out. print statement.
E. The code segment does not work as intended for any values of len1, len2, and len3. It returns the sum of 0.5 and the three lengths for all values of len1, len2, and len3.
Computers and Technology
1 answer:
Lynna [10]3 years ago
5 0

Answer:

The answer is "option B".

Explanation:

In the given code, four double variable "len1, len2, len3, and total" is declared, in which the first three variables accept some value, and in the total variable, we add those variable. In the next step, an integer variable minLength is defined, which converts the decimal value to an integer and adds the value that is "0.5". In this section, the code uses as an intended purpose but only if the total of 3 lengths is equivalent to or larger then 0.5, and wrong choices can be described as follows:

  • In option A, It accepts the negative value, that's why it is wrong.
  • Option C, Option D, and Option E all were wrong because the code segment is work as intended.
You might be interested in
One of the most common encryption protocols in use today. It is an asymmetric protocol that enables the sharing of a secret key
Thepotemich [5.8K]

Answer:

This explanation is true.

Explanation:

The most common forms of encryption used today are;

  • Data Encryption Standard / DES
  • Triple DES
  • Advanced Encryption Standard / AES
  • Twofish

which are mostly symmetric encryption protocols. They use the same key codes for both parties involved in the communication process.

Asymmetric Encryption is widely used in daily communications that is done over the internet and it uses different keys for each party. The public key encrypts the message and then it is sent over to the recipient. The secret key which they have exchanged is then used the decrypt the message.

I hope this answer helps.

7 0
3 years ago
The mathematical order of operations is used in Excel when formulas are evaluated. This order of operations states the order to
san4es73 [151]
The answer is d. I hope this helps you and computers/technology is no joke.
3 0
3 years ago
Read 2 more answers
You can use this effect to break a color into a percentage of its full strength.
Dmitriy789 [7]
The answer on this scenario would then be c. drop out. This effect can be done if one wants to break a color into one's percentage of the full strength. Hope this is the answer and would be of big help.
6 0
3 years ago
For off campus work study positions, students should contact the
anygoal [31]

Answer:

The answer is "financial aid office".

Explanation:

The work studies are a good way for people to raise funds in component-time on-campus jobs for payment for tuition. In off-campus study, it uses financial aid office, that provides learners to chance to gain useful job experiences when they study at university.

  • It usually works with you even if you have received an admission invitation.
  • In off-campus study work, it uses the department of Financial Aid, in which it is used to find the financial aid office of your school.
  • It can scan the sorted alphabetically lists below.
7 0
3 years ago
What changes could you make so that a message, "User input deemed invalid." during designing a simple calculator program for you
Afina-wow [57]

The most appropriate change in this situation would be to change the message "User input deemed invalid" to "You made a mistake, try again, you can".

<h3>What should we change to improve the children's experience?</h3>

To improve children's experience with this new calculator program, we must adapt all the features of the program for children's users. Therefore, the buttons, the messages and everything related to this program must be suitable for their motor and brain development.

Therefore, it is considered that the message "User input deemed invalid" is not suitable for children because they may not understand this message or misinterpret it and desist from using the new program.

So, the most appropriate message to replace the previous message would be:

  • "You made a mistake, try again, you can"

Because this message is suitable for the friendly language that children use in their daily lives and they would better understand the message without giving up using the new program or the calculator.

Learn more about programs in: brainly.com/question/13264074

#SPJ1

3 0
2 years ago
Other questions:
  • Jannette has been experiencing slow performance on her computer. Today she received an error message saying that an update to he
    12·2 answers
  • A software program that allows a programmer to type in code. modern versions usually make it easy to format the code on the scre
    13·1 answer
  • By issuing concert tickets on the blockchain, fans can verify transfer of ownership from one digital wallet to another, rather t
    14·1 answer
  • The quality of a language that allows a programmer to express a computation clearly, correctly, concisely, and quickly is called
    7·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Describe an application where a parallel circuit might work better than a series circuit.
    15·1 answer
  • 2. (8 points) When creating the Academic Database, there were several instances of data
    11·1 answer
  • Write an algorithm that accepts two numbers,
    7·1 answer
  • Sally has 4 quarters, 2 dimes, 6 nickels, and 10 pennies.
    13·2 answers
  • Question 2 of 25
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!