In an RPG your level is mostly determined by the amount of experience you have received. Each level will cost “more” experience than the previous level. In this exercise you’ll create a calculator that can determine the level of a character best on their total amount of experience.
Note that you should implement this exercise using an array so it is really easy to add additional levels!
Use the following table as guideline: int[] xpPerLevel = { 100, 300, 600, 1000, 1500, 2100, 2700, 3500 };
Level | Experience Range |
---|---|
1 | 0-100 |
2 | 101-300 |
3 | 301-600 |
4 | 601-1000 |
5 | 1001-1500 |
6 | 1501-2100 |
7 | 2101-2700 |
8 | 2701-3500 |