Question: run using Java language please. thanks Here's what wikipedia has to say about the Collatz Conjecture: The Collatz conjecture is a conjecture e in mathematics

 run using Java language please. thanks Here's what wikipedia has to
run using Java language please. thanks

Here's what wikipedia has to say about the Collatz Conjecture: The Collatz conjecture is a conjecture e in mathematics e that concerns a sequence e defined as follows: start with any positive integere n. Then each term is obtained from the previous term as follows: if the previous term is evene, the next term is one half of the previous term. If the previous term is odd, the next term is 3 times the previous term plus 1. The conjecture is that no matter what value of n, the sequence will always reach 1. The sequence of numbers involved is sometimes referred to as the hailstone sequence or hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstonese in a cloud) For this assignment you must write a Java program that does the following: 1) Ask the user for a positive integer (you do not for this assignment, have to validate user input) 2) prints every term of the hailstone sequence from that number to 1. To recap how the hailstone sequence works: If the previous term is even the next term is one half of the previous term If the previous term is odd, the next term is three times the previous term, plus 1. You may, if you like, put the entire program in your main function, or in static helper functions. You may also make it a fully object-oriented hailstone number finder, if you so desire

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!