subject

A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 50 random die tosses in
an array and prints the die values, making the runs by including
them in parentheses, like this:

1 2 (5 5) 3 1 2 4 3 (2 2 2 2) 3 6 (5 5) 6 3 1

Add a method alternatingSum() that returns the sum of the
alternating elements in the array and subtracts the others. For
example, if your array contains:

1 4 9 16 9 7 4 9 11
Then the method should compute:

1-4+9-16+9-7+4-9+11 = -2

I am having trouble with this code can someone please help me?

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Can you make money in why are you guys so
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
The fourth generation of computers emerged between 1970s and 1980s. which technological advancement brought about this generation of computers? which computer architecture was used most in this generation?
Answers: 3
question
Computers and Technology, 22.06.2019 20:40
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
Which option allows you to view slides on the full computer screen?
Answers: 1
You know the right answer?
A run is a sequence of adjacent repeated values. Write a program that generates a sequence of 50 ra...
Questions
question
Mathematics, 12.06.2020 14:57
question
English, 12.06.2020 14:57
question
Mathematics, 12.06.2020 14:57
question
English, 12.06.2020 14:57
question
Physics, 12.06.2020 14:57
Questions on the website: 13722361