subject

We want to create a class that represents a geometric sequence. A geometric sequence is a sequence
of numbers that begin at some value and then multiplies each value by some constant to get the next
value. For example, the geometric sequence 1, 2, 4, 8, 16 starts at 1 and multiplies each term by 2 to get
the next. The geometric sequence 10.8, 5.4, 2.7, 1.35 starts at 10.8 and multiplies each term by 0.5 to get
the next. The basic framework of a geometric sequence class is below:

public class GeometricSequence
{
private double initialValue;
private double multiplier;
}
We want to produce elements of the geometric sequence using codeSystem. out. println (first. next());
// Prints 1 and advances
System. out. println (first. next()); // Prints 2 and advances
System. out. println (first. next()); // Prints 4 and advances
System. out. println (first. next()); // Prints 8 and advances
System. out. println (second. next()); //Prints 10.8 and advances
System. out. println (second. next()); //Prints 5.4 and advances
System. out. println (second. next()); //Prints 2.7 and advances
What should the body of the next method be?

a) double result = initialValue;
initialValue = initialValue * multiplier;
return result;
b) return initialValue;
initialValue = initialValue * multiplier;
c) double result = initialValue;
multiplier = initialValue * multiplier;
return result;
d) initialValue = initialValue * multiplier;
return initialValue;

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
What is the foundation for proper monitoring, load balancing and routing in distributed systems
Answers: 3
question
Computers and Technology, 22.06.2019 11:30
To hide gridline when you display or print a worksheet
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
If you're using an existing powerpoint presentation that will receive new slides based on a word outline, select the a. slide that will appear after the new slides. b. first slide in the presentation. c. slide that will appear before the new slides. d. last slide in the presentation.
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
3. when you right-click a linked spreadsheet object, what commands do you choose to activate the excel features? a. linked worksheet object > edit b. edit data > edit data c. linked spreadsheet > edit d. object > edit data
Answers: 2
You know the right answer?
We want to create a class that represents a geometric sequence. A geometric sequence is a sequence <...
Questions
question
English, 25.11.2020 17:10
question
Spanish, 25.11.2020 17:20
Questions on the website: 13722359