subject

A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the following code segment is intended to 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 = lenl + len2 + len3; int minLength = (int) (total + 0.5); System. out. print(minLength);
Which of the following best describes the behavior of the code segment?
1. The code segment works as intended for all nonnegative values of lent, len2, and len3.
2. The code segment does not work as intended for some values of lent, len2, and len3. It could be corrected by casting lent, len2, and len3 to int before adding them together and assigning the sum to minLength. The code segment does not work as intended for any values of lent, len2, and len3. It returns the sum of 0.5 and the three lengths for all values of lent, len2, and len3. 3. 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. 4. The code segment does not work as intended for some values of lent, 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.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
What is the process in which the software development team compiles information to determine the final product
Answers: 1
You know the right answer?
A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the followin...
Questions
question
Mathematics, 13.11.2020 23:00
question
English, 13.11.2020 23:00
question
Chemistry, 13.11.2020 23:00
Questions on the website: 13722359