Java TOPIC 16 – IF STATEMENTS – PART
3 LESSON WORK QUESTION
1 You work for Blizzard and you have
been working on the latest release version of StarCraft. You have created five different AI behaviours for the computer named as follows: 1.
Normal 2.
Aggressive 3.
Expander 4.
Defensive 5.
Destroyer You have a simple job. You must write the program that will randomly
select one of the above AIs. However,
the odds that a specific AI is chosen need to be as follows: ·
Normal
– 50% ·
Aggressive
– 10% ·
Expander
– 20% ·
Defensive
– 15% ·
Destroyer
– 5% Before incorporating your program into
StarCraft, you need to write the program that outputs results like shown
below. SAMPLE OUTPUT
I Random number: 0.5503532659 SAMPLE OUTPUT
II Random number: 0.39405697593 AI: Normal Random number: 0.965403054311 QUESTION
2 public class SportsTeamName { public String adjective; public String nickname; public String city; } Adjectives: Happy, Glorious, Totally Angry,
Green, … Nicknames: Hammers, Clowns, Maples, Sea
Lions, … Here is some sample output with the
examples above: SAMPLE OUTPUT
1 Note: You must make use of the class
above. You must create the
object. Then you are to output the
content of the object like in the sample output. |
|