a method called nextNumber. For example, we can declare a statistician called s, and then give it the sequence of numbers 1.1, -2.4, 0.8 as shown here: statistician s; s.nextNumber (1.1);

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Question: Using Java (netbeans), Specify, design, and implement a class called statistician. After a statistician is initialized, it can be given a sequence of double numbers. Each number in sequence is given to the statistician by activating a method called nextNumber. For example, we can declare a statistician called s, and then give it the sequence of numbers 1.1, -2.4, 0.8 as shown here:

statistician s;

s.nextNumber (1.1);

s.nextNumber(-2.4);

s.nextNumber (0.8);

After a sequence has been given a statistician, there are various methods to obtain information about the sequence. Include methods that will provide the length of the sequence, the last number of the sequence, the sum of all numbers in a sequence, the arithmetic mean of the numbers (i.e., the sum of the numbers divided by the length of the sequence), the smallest number in the sequence, and the largest number in the sequence. Notice that the length andthe sum functions can be called at anytime, even if there are no numbers in the sequence. In this case of an "empty" sequence, both length and sum will be zero. The other methods should return Double.NaN if they are called for an empty sequence.

Notes: Do not try to store the entire sequence (because you don't know how long this sequence will be). Instead, just store the necessary information about the sequence: What is the sequence length, what is the sum of numbers in the sequence, and what are the last, smallest, and largest numbers? Each of these pieces of information can be stored in a private instance variable that is updated whenever nextNumber is activated.

Specify, design, and implement a class
2
called Statistician. After a statistician is
initialized, it can be given a sequence of
double numbers. Each number in the sequence is
given to the statistician by activating a method
called nextNumber. For example, we can declare a
statistician called s and then give it the
numbers 1.1, -2.4, 0.8, as shown here:
sequence
of
Statistician s = new Statistician();
s.nextNumber(1.1);
s.nextNumber(-2.4);
s. nextNumber(0.8);
After a sequence has been given to a statistician,
there are various methods to obtain information
about the sequence. Include methods that will pro-
vide the length of the sequence, the last number of
the sequence, the sum of all the numbers in the
sequence, the arithmetic mean of the numbers (i.e.,
the sum of the numbers divided by the length of the
sequence), the smallest number in the sequence, and
the largest number in the sequence. Notice that the
length and sum methods can be called at any time,
even if there are no numbers in the sequence. In this
ordinates x, y, and z. After rotating this location by
an angle 0, the location will have new coordinates,
which we'll call x' , y', and z'. The equations for the
new coordinates use the java.lang methods
Math.sin and Math.cos, as shown here:
After a 0 rotation around the x-axis:
x' = x
y' = y cos (0) – z sin(0)
z' = y sin(0) +z cos(0)
After a 0 rotation around the y-axis:
x' = x cos (0)+z sin(0)
y' = y
z' = -x sin (0) + z cos (0)
After a 0 rotation around the z-axis:
x' = x cos (0) –y sin(0)
y' = x sin (0) + y cos(0)
z = Z
Transcribed Image Text:Specify, design, and implement a class 2 called Statistician. After a statistician is initialized, it can be given a sequence of double numbers. Each number in the sequence is given to the statistician by activating a method called nextNumber. For example, we can declare a statistician called s and then give it the numbers 1.1, -2.4, 0.8, as shown here: sequence of Statistician s = new Statistician(); s.nextNumber(1.1); s.nextNumber(-2.4); s. nextNumber(0.8); After a sequence has been given to a statistician, there are various methods to obtain information about the sequence. Include methods that will pro- vide the length of the sequence, the last number of the sequence, the sum of all the numbers in the sequence, the arithmetic mean of the numbers (i.e., the sum of the numbers divided by the length of the sequence), the smallest number in the sequence, and the largest number in the sequence. Notice that the length and sum methods can be called at any time, even if there are no numbers in the sequence. In this ordinates x, y, and z. After rotating this location by an angle 0, the location will have new coordinates, which we'll call x' , y', and z'. The equations for the new coordinates use the java.lang methods Math.sin and Math.cos, as shown here: After a 0 rotation around the x-axis: x' = x y' = y cos (0) – z sin(0) z' = y sin(0) +z cos(0) After a 0 rotation around the y-axis: x' = x cos (0)+z sin(0) y' = y z' = -x sin (0) + z cos (0) After a 0 rotation around the z-axis: x' = x cos (0) –y sin(0) y' = x sin (0) + y cos(0) z = Z
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY