subject

(c) The method propLong(int n) returns the proportion of long hailstone sequences with starting values between 1 and n, inclusive. Consider the following table, which provides data about the hailstone sequences with starting values between 1 and 10, inclusive.

Starting
Value Terms in the Sequence Length of the
Sequence Long?
1 1 1 No
2 2, 1 2 No
3 3, 10, 5, 16, 8, 4, 2, 1 8 Yes
4 4, 2, 1 3 No
5 5, 16, 8, 4, 2, 1 6 Yes
6 6, 3, 10, 5, 16, 8, 4, 2, 1 9 Yes
7 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 17 Yes
8 8, 4, 2, 1 4 No
9 9, 28, 14, 7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1 20 Yes
10 10, 5, 16, 8, 4, 2, 1 7 No

The method call Hailstone. propLong(10) returns 0.5, since 5 of the 10 hailstone sequences shown in the table are considered long.

Write the propLong method. Assume that hailstoneLength and isLongSeq work as intended, regardless of what you wrote in parts (a) and (b). You must use isLongSeq appropriately to receive full credit.

/** Returns the proportion of the first n hailstone sequences that are considered long,

* as described in part (c).

* Precondition: n > 0

*/

public static double propLong(int n)

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:00
Why should characters such as / \ " ' * ; - ? [ ] ( ) ~ ! $ { } < > # @ & | space, tab, and newline be avoided in file names?
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
What is the opening page of a website called? a. web page b. landing page c. homepage d. opening page
Answers: 1
question
Computers and Technology, 25.06.2019 04:30
Which relativos possible when two tables share the same primary key? a.) one-to-one b.) one-to-many c.) many-to-one d.) many-to-many
Answers: 2
question
Computers and Technology, 25.06.2019 11:30
Aubrey didnt like to use graphics or images on her slides. she preferred to use only a title for her slides and bullet-poinged text. what is the best thing you could say to aubrey about using media that might change her mind? a. as long as you use it responsibly, it will only enhance your slides and engage your audience. b. actually, aubrey's beliefs are well founded and backed up by research. c. you should always try to inlcude as much media as you can on a slide. d. media will keep your audience entertained and take the pressure off the presenter.
Answers: 1
You know the right answer?
(c) The method propLong(int n) returns the proportion of long hailstone sequences with starting valu...
Questions
question
Mathematics, 20.08.2020 21:01
question
History, 20.08.2020 21:01
question
Mathematics, 20.08.2020 21:01
Questions on the website: 13722361