Create dungeons and dragons character sheet code. Create oneclass "Character" so that each character only has one attribute -Strength. Then, create another "Monster" class so that each monsteronly has a Strength attribute also. Use a loop to cycle through thecharacters, and output who for each character if they will beat themonster based on whose Strength attribute is higher. Update thestrength of the monster such that every time a character attacksthe monster, the monster's strength is depleted by the character.The monster's minimum strength value is 0. In the event of a tie,the character should win. See the desired output below:
Please enter the number of characters you wish to have: 4 Please enter a name: Will Please enter Will's strength: 7 Please enter a name: Mike Please enter Mike's strength: 4 Please enter a name: Dustin Please enter Dustin's strength: 9 Please enter a name: Lucas Please enter Lucas's strength: 6 Please enter the name of the monster: Demogorgon Please enter the monster's strength: 20 Please enter the monster's strength: 20 Will is fighting Demogorgon Demogorgon wins Monster strength: 13 Mike is fighting Demogorgon wins Monster strength: 9 Dustin is fighting Demogorgon Dustin wins Monster strength: 0 Lucas is fighting Demogorgon Lucas wins Monster strength: 0 Demogorgon
Create dungeons and dragons character sheet code. Create one class "Character" so that each character only has one attri
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am