Steven Herther

Greenhorn

Posts: 13

posted 3 years ago

For my assignment, I have to allow the player to select 6 numbers from two different lists as they please.

After they have selected their numbers say [100, 3, 5, 6, 9, 5] they then generate a target number of lets say for example 299 and they then can only use the numbers selected as a means of reaching the target using ONLY multiplication, addition, subtraction and division. So they could input for instance, 100 * 3 + 5 - 6 to reach the 299 target and this would be checked and scored appropriately.

Unfortunately I don't really have much to go on and I'm a bit confused on how to go about even starting to do that, I'm not looking for a straight up answer, maybe some pointers or external help would be much appreciated.

After they have selected their numbers say [100, 3, 5, 6, 9, 5] they then generate a target number of lets say for example 299 and they then can only use the numbers selected as a means of reaching the target using ONLY multiplication, addition, subtraction and division. So they could input for instance, 100 * 3 + 5 - 6 to reach the 299 target and this would be checked and scored appropriately.

Unfortunately I don't really have much to go on and I'm a bit confused on how to go about even starting to do that, I'm not looking for a straight up answer, maybe some pointers or external help would be much appreciated.

posted 3 years ago

- 1

It doesn't sound like you have a Java problem (yet), it seems more like you are not clear what you need to do.

Take the information that you have been provided, and think-about how you and a friend would play this game using just pencil and paper. Go through the process of trying it out, identifying any issue, and making changes until you are sure that it is correct and complete. After that, think-about how you might perform each of the steps with Java.

Take the information that you have been provided, and think-about how you and a friend would play this game using just pencil and paper. Go through the process of trying it out, identifying any issue, and making changes until you are sure that it is correct and complete. After that, think-about how you might perform each of the steps with Java.

posted 3 years ago

For example:

Ron McLeod wrote:Take the information that you have been provided, and think-about how you and a friend would play this game using just pencil and paper.

For example:

**You**: Present the large list ask your friend to pick a single number from the list.**Friend**: Picks a number and tells you.**You**: Verify that the number was in the list that you presented.**You**: Write the number down for use later.**You**: Present the small list ask your friend to pick 5 numbers number from the list.**Friend**: Picks 5 numbers and tells you.**You**: Verify that the numbers were in the list that you presented, and that each number was only selected once.**You**: Write the numbers down for use later.**You**: Calculate a target number which could be generated using the numbers that your friend picked using only +-*/.**You**: Present the target number, and ask your friend to use the numbers that they picked and the +-*/ operators to equal the target number.**Friend**: Works-out an answer and tells you.**You**: Verify that only the picked numbers were used in the answer.**You**: Evaluate the answer and verify that it is correct.**You**: Adjust your friend's score.