Beruflich Dokumente
Kultur Dokumente
Note: You can work in groups of two for this program. Please dont ask me if you can have three or more.
Additional Note: Im also teaching a graduate Object Oriented Programming course this semester using the Java
language. The graduate students had to do a similar StarCraft project but be aware that their project was a little
different. There were a few additional things they had to do and their project did not include multiple inheritance
and the SuperSoldier class (Java does not support multiple inheritance.) I just wanted to let you all know in case
you are working in the lab and getting help from one of the graduate assistants who might assume it is the same
project as theirs. Please do your best to successfully complete this project. We might utilize this as a framework
for the final semester project. Again, you can work with a partner on this.
Program Description
This programing assignment will focus on C++ inheritance, polymorphism, and multiple inheritance, which are three
recent topics we have covered this semester.
This program will be loosely based on the game of StarCraft. For those unfamiliar with the game, StarCraft is a
military science fiction real-time strategy video game developed and published by Blizzard Entertainment back in
1998 (from Wikipedia). The game revolves around three species fighting for dominance. They are the Terrans
(humans), the Zerg, and the Protoss. Each species has various types of soldiers, vehicles, and weapons that you can
build during the game.
Marine Class
In addition to the things inherited from the Infantry class, the Marine class
should include the attribute of assaultRifle which will keep track of the number
of machine gun rounds. Marine should have constructors, and set and get
methods for the assaultRifle. In the Marine implementation of the speak
method, he should output his name followed by the phrase You wanna piece of
me, boy? The attack method should accept as a reference parameter an
Infantry object (that is referring to an object of any soldier type). The attack
method should then call the getAttacked method of the object and send in the
amount of health to deduct from the attacked soldier. A Marine attack should
probably deduct something like 10 from the health. Attack also needs to deduct some rounds from the assaultRifle
attribute. Each soldier type will have a renderAid method that can be called to help a fellow injured soldier.
Obviously, the Medic class will be able to offer the most help but the Marine should have some limited ability. The
Marine renderAid method should do something like the following: If the injured soldiers health is 75 or higher,
output You aint hurt, boy! Now get up and fight! If the injured soldiers health is greater than 25 but less than
75, output Let me patch you up, boy! and then call the injured soldiers receiveAid method with a value of 10 to
be added to his health. If the injured soldiers health is 25 or less output Sorry, broYou aint gonna make it. and
then give him a 50% chance of dying (in which you call the die method). The die method for Marine (and the other
types) should set the health and weapons attributes to zero and output a message announcing the soldiers death.
Firebat Class
The Firebat is similar to the Marine but has a flameThrower as his weapon. When
he speaks, he says his name followed by the phrase Need a light? Firebats
attack should deduct 20 units of health. Firebat is not able to render aid so his
method for that should output something like Sorry Dude. Ive got no first aid
supplies. Keep thinking positive thoughts!
Ghost Class
The Ghost is a sneaky type of soldier. He has a sniperRifle to keep track of the
number of rifle bullets he has and cloak (should be a Boolean) that keeps track of
the status of his invisibility. When he speaks, the Ghost says his name followed by
the phrase Somebody call for an exterminator? The Ghost renderAid method
should only add 5 to the injured soldiers health and should output a message such
as You dont see meI was never here. If the cloak is set to true, the Ghosts
health should not be affected by an attack.
Medic Class
The only weapon the Medic has is the pistol attribute that is inherited from
Infantry. Medic has a boosterShot. Each time the Medic renderAid method is
called, the number of boosterShot is decremented and will add 30 to the injured
soldiers health. When a Medic speaks, he says his name followed by the phrase
Prepped and ready. The Medic attack only deducts 5 units of health from the
soldier being attacked.