102k views
1 vote
An online game is played with two dice. In this context, explain what is meant by decomposition

User Tovmeod
by
7.9k points

1 Answer

1 vote
You want to throw 2 dice and get (or show?) their value.
Their value is random, so you need to generate two numbers between 1 & 6.
You may need to display the numbers
The main part of the program needs to know the numbers to limit what the user may do next.


That's most of the first level of decomposition. You need to keep decomposing (breaking into smaller simpler pieces) (think of an outline) and deciding what objects, functions, data structures and logic you're going to use to code this.
User Jesika
by
7.5k points