# Please answer my question

Discussion in 'C' started by pirsultanabidal, Jul 20, 2011.

1. ### pirsultanabidalNew Member

Joined:
Oct 19, 2010
Messages:
1
Likes Received:
0
Trophy Points:
0
1) The parents of an 8 children family have bought them each a coin box (kumbara), which store
only coins. The boxes can distinguish and count different types of coins (that are, 1Kr, 5Kr, 10Kr,
25Kr, 50Kr, and 100Kr). You are supposed to store in a two-dimensional array each childâ€™s boxâ€™s
current state, which is the current number of coins of each type.
Sample coin boxes matrix
1Kr 5Kr 10Kr 25Kr 50Kr 100Kr
0 1 2 3 4 5
Veli 0 1 3 5 0 0 1
Ayşe 1 0 1 1 2 3 0
Hasan 2 3 12 0 1 0 0
. 3 . . . . . .
. 4 . . . . . .
. 5 . . . . . .
. 6 . . . . . .
Ali 7 5 2 1 0 0 9
a) [ 35p | ] Write a function, named insertCoin, which
â€¢ inputs (as parameters)
o a two-dimensional array (matrix),
o coin box number (row number of array from 0 up to 7 since there are 8 children)
o coin value (1, 5, 10, 25, 50, or 100Kr)
â€¢ updates (the two-dimensional array parameter)
o by incrementing the necessary column of the specified row.
b) [ 25p | ] Write a function, named countMoney, which returns the total amount of money
in all coin boxes in Turkish Liras.
c) [ 40p | ] Write a sample main, which
â€¢ declares a two-dimensional array for 8 childrenâ€™s coin boxes.
â€¢ inputs in a loop
o child no and
o the value of the coin, (s)he inserted to the box
â€¢ until the user enters an invalid child no.
â€¢ displays the total amount of money in the coin boxes.