Question: In this assignment, you will get practice with the concept of parallel arrays. To keep all the information about each dragon, we will have a
In this assignment, you will get practice with the concept of parallel arrays. To keep all the information about each dragon, we will have a number of arrays one for each attribute that the dragons might have. Here are the attributes that each dragon will have: a name, what type of dragon it is what its natural element is like Earth, Air, Fire, Water, etc. how many hit points HP the dragon has when you run out of HP you are defeated what its primary weapon is what the maximum damage that weapon can do and an elemental weakness eg if it has an Earth weakness and its fighting an Earth dragon, the Earth dragon will be able to do more damage So for each of these there will be an array. Thats seven arrays. But these arrays are all kept in parallel: So for example, name is the name of the third dragon, and dragonType is the type of dragon of the third dragon, and element is the element of the third dragon, and so forth. So that third dragons information is spread across a number of different arrays, that are all kept in parallel. Each dragon has a number, though this isnt stored anywhere its just the index of each of the attribute arrays. The image here shows a few of the dragons:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
