Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA This program must help the user build an adventuring party for an adventure game. The party must contain 6 characters, one of each

IN JAVA

image text in transcribed

image text in transcribed

image text in transcribed

This program must help the user build an adventuring party for an adventure game. The party must contain 6 characters, one of each of these professions: Fighter, Ranger, Mage, Cleric, Rogue, and Bard. Each character in the party has 6 attributes called "stats". The 6 stats are: Strength, Constitution, Intelligence, Wisdom, Dexterity, and Charisma. These stats have values that range from 3 (terribly low) to 18 (amazingly high). The higher the stat, the better for that character. A character's collection of 6 stats is called the "stat block" for that character. Stats and Professions: Each profession benefits from different stats for optimal performance. For example, Fighters benefit most from a high Strength while Bards rely on Charisma. Each profession has 1 primary stat, 2 secondary stats, 2 tertiary stats, and one "dump" stat. The primary stat is the most important while the dump stat is the least. Below is a chart of each profession and the stat combination that represents the stats' relative importance for that profession. In the chart, "P" stands for primary, "S" for secondary, "T" for tertiary, and "D" for dump. Str Int Wis Dex | Cha S T Profession Fighter Ranger Mage Cleric Rogue Bard S S D T ating for each profession: In order to evaluate the quality of a stat block for a given profession, use this formula: (primary * 10) + seco 5) + (tertiary1 * 2) + (tertiary2 * 2) + dump). The ordering of the two secondary stats and the two tertiary stats is not important. This formula will give a maximum rating of 450 for a stat block of all 18's. The same formula applies to all professions, but each profession has a different combination of primary, secondary, tertiary, and dump stats, so the same stat block will usually have a different rating for different professions. Stat bonuses: For each stat, a bonus must be calculated. This bonus is calculated by subtracting 10 from the stat, then dividing the result by 2 (rounding down). These bonuses must show up on the display of the party's stat blocks. See the example output. Your job: You are to write a program that generates a random stat block (see below on how) and then allows the user to assign that stat block to one of the six professions. Repeat this until all professions have a stat block. Once a stat block is assigned to a profession, that profession cannot accept another stat block. See the example execution to see how the program should look. Stat short names: Stats have these short names: (Str, Con, Int, Wis, Dex, Cha). How to generate a stat block: For each stat, "roll 4 dice and add the biggest three values together. This results in numbers between 3 and 18. To roll a die, set up a Random object and use (nextInt(6) + 1). I will show you how to do this in class. Big Hint: Don't use the name Character for a class. Class Character is already used in Java! What to turn in: Any.java files you make to complete the program. Example Output: New stats generated Welcome to the build-an-adventuring-party program! randomly Here's a new stat block: Character{Str=13 Con=13 Int=11 Wig=10 Dex=11 Cha= 9 Fighter=299 Ranger=298 Mage=266 Cleric=269 Rogue=284 Bard=259) Current Party: 1. Fighter (0): empty 2.Ranger (0): empty Ratings for this stat block for 3.Mage (0): empty 4.cleric (0): empty each profession 5. Rogue (0): empty 6.Bard (0): empty Which position would you like to fill? (1..6): 6 Here's a new stat block: Character{Str=10 Con=14 Int= 6 Wis=14 Dex=10 Cha=16 Fighter=286 Ranger=308 Mage=264 Cleric=332 Rogue=254 Bard=306} Current Party: 1.Fighter (0): empty Note how correct rating is added to 2.Ranger (0): empty party member's stat block 3.Mage (0): empty 4.Cleric (0): empty 5.Rogue (0): 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 4 Here's a new stat block: Character Str=12 Con=14 Int=13 Wig=14 Dex=10 Cha=12 Fighter=305 Ranger=328 Mage=318 Cleric=330 Rogue=291 Bard=303} Current Party: 1. Fighter (0): empty 2.Ranger (0): empty 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10(+0) Cha=16(+3) 5. Rogue (0): empty 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 0 That's not in range. Choose 1..6: 7 That's not in range. Choose 1..6: 6 That spot is already filled. Note error trapping for Which position would you like to fill? (1..6): 4 bad positions That spot is already filled. Which position would you like to fill? (1..6): 2 Here's a new stat block: Character{Str=15 Con=14 Int=13 Wig=15 Dex=13 Cha=10 Fighter=348 Ranger=352 Mage=325 Cleric=339 Rogue=333 Bard=303) Current Party: 1.Fighter (0): empty 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wis=14(+2) Dex=10(+0) Cha=12(+1) 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (0): empty 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 1 Here's a new stat block: Character{Str= 9 Con=13 Int=13 Wig=13 Dex=15 Cha=13 Fighter=295 Ranger=309 Mage=321 Cleric=319 Rogue=325 Bard=331} Current Party: 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wis=15(+2) Dex=13 (+1) Cha=10(+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (0): empty 4.Cleric (332): Str=10(+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10(+0) Cha=16(+3) 5. Rogue (0) : empty 6.Bard (259): Str=13(+1) Con=13 (+1) Int=11(+0) Wis=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 5 Here's a new stat block: Character {Str=10 Con=11 Int=15 Wig= 8 Dex=15 Cha= 8 Fighter=277 Ranger=268 Mage=291 Cleric=240 Rogue=321 Bard=278) Current Party: 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wis=15(+2) Dex=13 (+1) Cha=10(+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wig=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (325): Str= 9(+0) Con=13 (+1) Int=13(+1) Wig=13 (+1) Dex=15(+2) Cha=13 (+1) 6.Bard (259): Str=13 (+1) Con=13 (+1) Int=11(+0) Wig=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 3 Here's your final party! Good luck out there! 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wig=15(+2) Dex=13 (+1) Cha=10 (+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13 (+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (291): Str=10 (+0) Con=11 (+0) Int=15(+2) Wis= 8(-1) Dex=15(+2) Cha= 8(-1) 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wig=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (325): Str= 9(+0) Con=13 (+1) Int=13(+1) Wig=13 (+1) Dex=15 (+2) Cha=13 (+1) 6.Bard (259): Str=13(+1) Con=13 (+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Bonuses are only required once a stat block is put into the party, but if you add them to the new stat block display, that's ok. This program must help the user build an adventuring party for an adventure game. The party must contain 6 characters, one of each of these professions: Fighter, Ranger, Mage, Cleric, Rogue, and Bard. Each character in the party has 6 attributes called "stats". The 6 stats are: Strength, Constitution, Intelligence, Wisdom, Dexterity, and Charisma. These stats have values that range from 3 (terribly low) to 18 (amazingly high). The higher the stat, the better for that character. A character's collection of 6 stats is called the "stat block" for that character. Stats and Professions: Each profession benefits from different stats for optimal performance. For example, Fighters benefit most from a high Strength while Bards rely on Charisma. Each profession has 1 primary stat, 2 secondary stats, 2 tertiary stats, and one "dump" stat. The primary stat is the most important while the dump stat is the least. Below is a chart of each profession and the stat combination that represents the stats' relative importance for that profession. In the chart, "P" stands for primary, "S" for secondary, "T" for tertiary, and "D" for dump. Str Int Wis Dex | Cha S T Profession Fighter Ranger Mage Cleric Rogue Bard S S D T ating for each profession: In order to evaluate the quality of a stat block for a given profession, use this formula: (primary * 10) + seco 5) + (tertiary1 * 2) + (tertiary2 * 2) + dump). The ordering of the two secondary stats and the two tertiary stats is not important. This formula will give a maximum rating of 450 for a stat block of all 18's. The same formula applies to all professions, but each profession has a different combination of primary, secondary, tertiary, and dump stats, so the same stat block will usually have a different rating for different professions. Stat bonuses: For each stat, a bonus must be calculated. This bonus is calculated by subtracting 10 from the stat, then dividing the result by 2 (rounding down). These bonuses must show up on the display of the party's stat blocks. See the example output. Your job: You are to write a program that generates a random stat block (see below on how) and then allows the user to assign that stat block to one of the six professions. Repeat this until all professions have a stat block. Once a stat block is assigned to a profession, that profession cannot accept another stat block. See the example execution to see how the program should look. Stat short names: Stats have these short names: (Str, Con, Int, Wis, Dex, Cha). How to generate a stat block: For each stat, "roll 4 dice and add the biggest three values together. This results in numbers between 3 and 18. To roll a die, set up a Random object and use (nextInt(6) + 1). I will show you how to do this in class. Big Hint: Don't use the name Character for a class. Class Character is already used in Java! What to turn in: Any.java files you make to complete the program. Example Output: New stats generated Welcome to the build-an-adventuring-party program! randomly Here's a new stat block: Character{Str=13 Con=13 Int=11 Wig=10 Dex=11 Cha= 9 Fighter=299 Ranger=298 Mage=266 Cleric=269 Rogue=284 Bard=259) Current Party: 1. Fighter (0): empty 2.Ranger (0): empty Ratings for this stat block for 3.Mage (0): empty 4.cleric (0): empty each profession 5. Rogue (0): empty 6.Bard (0): empty Which position would you like to fill? (1..6): 6 Here's a new stat block: Character{Str=10 Con=14 Int= 6 Wis=14 Dex=10 Cha=16 Fighter=286 Ranger=308 Mage=264 Cleric=332 Rogue=254 Bard=306} Current Party: 1.Fighter (0): empty Note how correct rating is added to 2.Ranger (0): empty party member's stat block 3.Mage (0): empty 4.Cleric (0): empty 5.Rogue (0): 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 4 Here's a new stat block: Character Str=12 Con=14 Int=13 Wig=14 Dex=10 Cha=12 Fighter=305 Ranger=328 Mage=318 Cleric=330 Rogue=291 Bard=303} Current Party: 1. Fighter (0): empty 2.Ranger (0): empty 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10(+0) Cha=16(+3) 5. Rogue (0): empty 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 0 That's not in range. Choose 1..6: 7 That's not in range. Choose 1..6: 6 That spot is already filled. Note error trapping for Which position would you like to fill? (1..6): 4 bad positions That spot is already filled. Which position would you like to fill? (1..6): 2 Here's a new stat block: Character{Str=15 Con=14 Int=13 Wig=15 Dex=13 Cha=10 Fighter=348 Ranger=352 Mage=325 Cleric=339 Rogue=333 Bard=303) Current Party: 1.Fighter (0): empty 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wis=14(+2) Dex=10(+0) Cha=12(+1) 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (0): empty 6.Bard (259): Str=13(+1) Con=13(+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 1 Here's a new stat block: Character{Str= 9 Con=13 Int=13 Wig=13 Dex=15 Cha=13 Fighter=295 Ranger=309 Mage=321 Cleric=319 Rogue=325 Bard=331} Current Party: 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wis=15(+2) Dex=13 (+1) Cha=10(+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (0): empty 4.Cleric (332): Str=10(+0) Con=14(+2) Int= 6(-2) Wis=14(+2) Dex=10(+0) Cha=16(+3) 5. Rogue (0) : empty 6.Bard (259): Str=13(+1) Con=13 (+1) Int=11(+0) Wis=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 5 Here's a new stat block: Character {Str=10 Con=11 Int=15 Wig= 8 Dex=15 Cha= 8 Fighter=277 Ranger=268 Mage=291 Cleric=240 Rogue=321 Bard=278) Current Party: 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wis=15(+2) Dex=13 (+1) Cha=10(+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13(+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (0): empty 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wig=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (325): Str= 9(+0) Con=13 (+1) Int=13(+1) Wig=13 (+1) Dex=15(+2) Cha=13 (+1) 6.Bard (259): Str=13 (+1) Con=13 (+1) Int=11(+0) Wig=10 (+0) Dex=11(+0) Cha= 9(+0) Which position would you like to fill? (1..6): 3 Here's your final party! Good luck out there! 1. Fighter (348): Str=15(+2) Con=14(+2) Int=13(+1) Wig=15(+2) Dex=13 (+1) Cha=10 (+0) 2.Ranger (328): Str=12 (+1) Con=14(+2) Int=13 (+1) Wig=14(+2) Dex=10 (+0) Cha=12 (+1) 3.Mage (291): Str=10 (+0) Con=11 (+0) Int=15(+2) Wis= 8(-1) Dex=15(+2) Cha= 8(-1) 4.Cleric (332): Str=10 (+0) Con=14(+2) Int= 6(-2) Wig=14(+2) Dex=10 (+0) Cha=16(+3) 5. Rogue (325): Str= 9(+0) Con=13 (+1) Int=13(+1) Wig=13 (+1) Dex=15 (+2) Cha=13 (+1) 6.Bard (259): Str=13(+1) Con=13 (+1) Int=11(+0) Wis=10(+0) Dex=11(+0) Cha= 9(+0) Bonuses are only required once a stat block is put into the party, but if you add them to the new stat block display, that's ok

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

1. 2. How is a franchise different from a partnership?

Answered: 1 week ago