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, 23.06.2019 13:30
Font size, font style, and are all aspects of character formatting.
Answers: 2
question
Computers and Technology, 23.06.2019 21:20
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
1. which of these is not true about torsion bars? a. they can be used to adjust ride height b. they can be adjusted anytime since they don't affect alignment angles c. they attach between the frame and the lower control arm d. they twist to produce a spring effect
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
When writing a business letter, how many times can you use the same merge field in a document? once once, unless using the address block feature unlimited it will depend on the type of document you choose
Answers: 1
You know the right answer?
We want to create a class that represents a geometric sequence. A geometric sequence is a sequence <...
Questions
Questions on the website: 13722360