Java coding | Computer Science homework help

Get your original paper written from scratch starting at just $10 per page with a plagiarism report and free revisions included!

4.8

rating

SiteJabber

4.9

rating

ResellerRatings

4.9

rating

Reviews.io

Hire A Writer

A Fighter/Mage is one of the stronger multi-classes at the end of Baldur’s Gate 2, the seminal role-playing video game (cRPG) developed by BioWare. For character creation of a Fighter/Mage, the highest dice rolls should be allocated to strength (STR), intelligence (INT), dexterity (DEX), and constitution (CON) – in that order – and the lower statistics should go into wisdom (WIS) and charisma (CHA). Fill in code at the three (3) places marked YOUR CODE HERE. Upload your program.

 

import java.util.ArrayList;

import java.util.Collections;

import java.util.List;

import java.util.Random;

public class Main {

public static class dndCharacter {

private String name;

private int STR;

private int INT;

private int DEX;

private int CON;

private int WIS;

private int CHA;

public dndCharacter(String myName) {

name = myName;

List statList = new ArrayList();

// get 6 random stats

for (int i = 0; i < 6; i++) {

statList.add(characterStat());

}

// order statList low to high

Collections.sort(statList);

// access elements with statList.get(index) for index f

rom 0 to 5

// assign the character statistics high to low STR INT

DEX CON WIS CHA

// with values from the ordered statList

// YOUR CODE HERE

}

public String about() {

String aboutMe = “”;

aboutMe += “Hi! My name is ” + name+”\n”;

aboutMe += “I am a Fighter/Mage”+”\n”;

if (STR + INT + DEX + CON + WIS + CHA > 6 * 9) {

aboutMe += “I am rather good at questing\n”;

aboutMe += “Strength: ” + STR+”\n”;

aboutMe += “Intelligence: ” + INT+”\n”;

aboutMe += “Dexterity: ” + DEX+”\n”;

aboutMe += “Constitution: ” + CON+”\n”;

aboutMe += “Wisdom: ” + WIS+”\n”;

aboutMe += “Charisma: ” + CHA+”\n”;

} else {

aboutMe += “But enough about me…”;

}

// create the correct return statement

// YOUR CODE HERE

}

static int characterStat() {

Random random = new Random();

int d1 = random.nextInt(5) + 1;

int d2 = random.nextInt(5) + 1;

int d3 = random.nextInt(5) + 1;

int d4 = random.nextInt(5) + 1;

int diceSum = d1 + d2 + d3 + d4;

int min = Math.min(d1, d2);

min = Math.min(min, d3);

min = Math.min(min, d4);

diceSum -= min;

return diceSum;

}

}

public static void main(String[] args) {

// YOUR CODE HERE

// modify myName to initialize dndCharacter

Main.dndCharacter FighterMage = new dndCharacter(“”);

System.out.println(FighterMage.about());

}

}

Stay Anonymous
With Our Essay Writing Service

The aim of our service is to provide you with top-class essay help when you ask us to write my paper; we do not collect or share any of your personal data. We use the email you provide us to send you drafts, final papers, and the occasional promotion and discount code, but that’s it!

Order Now