Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the code in java The game starts with a list of random positive integer numbers such that their sum 45. In each round, you

Write the code in java

The game starts with a list of random positive integer numbers such that their sum 45. In each round, you subtract one from each number in the list and remove it if it becomes zero, add the sum of the subtracted numbers to the end of the list. The game is over when the list has 1, 2, 3, 4, 5, 6, 7, 8, and 9, in some order. In your program, print the list after each round.

Here is a sample run of the program:

[18, 10, 7, 2, 4, 4]

[17, 9, 6, 1, 3, 3, 6]

[16, 8, 5, 2, 2, 5, 7]

[15, 7, 4, 1, 1, 4, 6, 7]

[14, 6, 3, 3, 5, 6, 8]

[13, 5, 2, 2, 4, 5, 7, 7]

[12, 4, 1, 1, 3, 4, 6, 6, 8]

[11, 3, 2, 3, 5, 5, 7, 9]

[10, 2, 1, 2, 4, 4, 6, 8, 8]

[9, 1, 1, 3, 3, 5, 7, 7, 9]

[8, 2, 2, 4, 6, 6, 8, 9]

[7, 1, 1, 3, 5, 5, 7, 8, 8]

[6, 2, 4, 4, 6, 7, 7, 9]

[5, 1, 3, 3, 5, 6, 6, 8, 8]

[4, 2, 2, 4, 5, 5, 7, 7, 9]

[3, 1, 1, 3, 4, 4, 6, 6, 8, 9]

[2, 2, 3, 3, 5, 5, 7, 8, 10]

[1, 1, 2, 2, 4, 4, 6, 7, 9, 9]

[1, 1, 3, 3, 5, 6, 8, 8, 10]

[2, 2, 4, 5, 7, 7, 9, 9]

[1, 1, 3, 4, 6, 6, 8, 8, 8]

[2, 3, 5, 5, 7, 7, 7, 9]

[1, 2, 4, 4, 6, 6, 6, 8, 8]

[1, 3, 3, 5, 5, 5, 7, 7, 9]

[2, 2, 4, 4, 4, 6, 6, 8, 9]

[1, 1, 3, 3, 3, 5, 5, 7, 8, 9]

[2, 2, 2, 4, 4, 6, 7, 8, 10]

[1, 1, 1, 3, 3, 5, 6, 7, 9, 9]

[2, 2, 4, 5, 6, 8, 8, 10]

[1, 1, 3, 4, 5, 7, 7, 9, 8]

[2, 3, 4,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[1, 2, 3, 4, 5, 6, 7,

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago