Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Details: You are tasked with (pseudo)-randomly assigning roles to a group of 5 players that are playing a sci-fi/fantasy game. Each player will be assigned

image text in transcribed

Details: You are tasked with (pseudo)-randomly assigning roles to a group of 5 players that are playing a sci-fi/fantasy game. Each player will be assigned one of four available roles. There is a possibility that some roles may be filled by more tha one player and that some roles may be unused. Implementation Each player is represented as a variable of the enumeration type role. role player5; /sample declaration of variable player5 of type role. Enum types will be discussed during lecture; see Savitch 119 120 for additional details. The constants for role are: BIT BARD BYTE_BRAWLER, DATA MAGE, TECH KNIGHT You will define two (2) functions for this assignment: assignRoles) has five parameters of role enum type, one for each player. This function randomly assigns a role constant to each player. This is a void function; if it helps, one can say that it returns five values. getRoleName) has one parameter of role enum type. This function outputs a string literal that represents that role. To illustrate, the constant DATA MAGE stored in the role parameter will be used to output the string literal "Data Mage Here are the string-type role names for each role-type constant: BIT_BARD -> "Bit Bard" BYTE BRAWLER -> "Byte Brawler DATA MAGE-> "Data Mage TECH KNIGHT -> "Tech Knight You may use the selection statement(s) of your choice in this function i.e, if/if-else, switch). main) must be used exclusively to: . declare five role variables call assignRoles() once

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions