I am making a knowledge based game , in which user participate and if they win and get their rank within criteria they earn gems , coins etc.
Example- A game in which their are 500 participants , and predefined Prize Distribution is Like...
Rank 1 gets 50000 coins
Rank 2 gets 40000 coins
Rank 3 to 50 gets 20000 coins
Rank 51 to 200 gets 5000 coins
Rank 201 to 500 gets 1000coins
If User plays the game and suppose he gets the rank 81 . So how can I check the distribution and award him the prize i.e, 5000 coins.
Can i use Hashmap to create some kind of key-value pair ..as shown below..
HashMap<Integer, Integer> distribution = new HashMap<>();
distribution.add(1,50000);
.
.
.
distribution.add(500,1000);
Any suggestions will boost my work.