Character stat card
Type a hero's name, class and level, and get their stat card: health, attack, speed, power and rank, worked out with maths, strings and if.
4 milestones
- 1The program reads three lines: the hero's name, their class and their level (a whole number). Start with a mage. A level 1 mage has HP 80, ATK 18 and SPD 8. Every level above 1 adds 12 HP, and every two levels above 1 add 1 ATK (so level 7 is 6 levels above 1: +72 HP, +3 ATK). SPD never changes. Power is ATK times SPD divided by 10, rounded to 1 decimal place. Print the card in four lines, exactly like this for
Nyx,mage,7:NYX the mage/Level 7 Rookie/HP 152 | ATK 21 | SPD 8/Power: 16.8 - 2Two more classes, with their own level 1 stats. A warrior has HP 120, ATK 14, SPD 6. A rogue has HP 95, ATK 12, SPD 12. The level rules and the card are the same for every class.
- 3The word after the level is the rank:
Rookiebelow level 20,Veteranfrom 20 to 39,Legendfrom 40. People typebrickandWARRIOR, so ignore spaces at either end, show the name in capitals and the class in lower case. - 4For a class the game does not have, print only
Unknown class: bard(the class as cleaned up). For a level below 1 or above 50, print onlyLevel must be 1 to 50. Check the class first.