Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java, please help! The setting: This program creates a party of 6 fantasy-adventure game characters. In the game, each character has 6 attributes called stats.

Java, please help!image text in transcribed

image text in transcribed

The setting: This program creates a party of 6 fantasy-adventure game characters. In the game, each character 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. In addition, each character must have a profession. There are six professions: Fighter, Ranger, Mage, Cleric, Rogue, and Bard. Stats and Professions: Each profession benefits from different stats. For example, Fighters benefit from a high Strength the most while Bards benefit from a high 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 Con Int Wis Dex Cha S D T S T S T S T D Profession Fighter Ranger Mage Cleric Rouge Bard T D P S T S T S T D S S T S D P T D T S T S P Character stat block rating for each profession: To evaluate the quality of a stat block for a given profession, use this formula: ((primary * 10) + (secondary1 * 5) + (secondary2 * 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: Each stat has a bonus based on its value. A stat's bonus is calculated using the following formula: ((stat -10) / 2). Not that this bonus is always a whole number. Every bonus must be displayed with a positive or negative sign. Zero bonuses should be shown with a positive sign. Examples: the bonus for 18 is +4 (18-10) / 2), the bonus for 10 is +0 ((10-10) / 2), and the bonus for 7 is -1 ((7-10) /2). Random stat generation: One common way to generate stats for characters is to roll dice. We will use the following technique: roll 4 six-sided dice and drop the lowest roll. This will result in a stat between 3 and 18, but will skew the average slightly higher than just rolling 3 six-sided dice. To generate a stat block, you must roll like this for each of the character's 6 stats. In order to simulate a die roll, create an object of Java's Random class (you will need to import java.util.Random) and use the nextInt() method. Here's an example: Declares an object of type Random Random rand = new Random(); Gets a random int between 0 and int dieRoll = rand.nextInt (6) + 1; 5 and adds 1 making it random between 1 and 6 The task: You are to write a program that generates a party of 6 powerful characters. One character per profession must be generated. A "powerful character is one with a rating of 350 or better in their highest rated profession. To do this: for each profession you must roll random stat blocks until you get one that is "powerful" in that profession. If you look at the sample output, notice how the program generates a Fighter for the party by rolling stat blocks until it gets one with Fighter as the highest rated profession and also that rating is 350 or higher. Once the party is generated, display it followed by the highest and lowest rated members. Displaying a character: Each time you display a character, you must show it in the following format, but fit it on one line: Best profession with rating Stat block with bonuses Rouge (353) {Str=14 (+2) Con=13 (+1) Int=13(+1) Wis=14(+2) Dex=16 (+3) Cha= 9(+0)} {Fighter=344 Ranger=337 Mage=318 Cleric=320 Rogue=353 Bard=303} All professions with ratings for each one In your output, make this one long line, not two as shown here Requirements: All output is to the screen. Every character displayed must be on one line of output, not two (the line is too long for this document). Don't forget to turn in only.java files and don't forget your comment headers. Handling ties when comparing things: when comparing things for any reason, if there is a tie, choose just one of them. I don't care which you choose or how. Big Hint: Don't use the name Character for any entity class. Class Character is already used in Java

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_2

Step: 3

blur-text-image_3

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

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions