Introduction to Software Development
GWU Computer Science
By the end of this module, you will be able to:
If you do not have your Codio course ready, use any text editor or simple IDE. Some possibilities are:
Zombies...
Eat brains of humans.
Turn bit humans into zombies.
Can be killed by humans.
Humans...
Shoot zombies in the brain (so much with the brains!).
Fight other humans, and might kill them. (Why so mean?)
Are turned into zombies when bit.
Have names.
Person joe = new Person("Joe");
Person bob = new Person("Bob");
Person jane = new Person("Jane");
Person z = new Person();
System.out.println(Person.numHumans() + " humans vs. " + Person.numZombies() + " zombies.");
z.bite(bob); // poor bob
bob.bite(z); // confused zombie
Person derpbie = bob;
derpbie.bite(derpbie); // this is getting ridiculous
System.out.println(Person.numHumans() + " humans vs. " + Person.numZombies() + " zombies.");
jane.shoot(z); // humans FTW!
jane.shoot(joe); // wait...what?
jane.shoot(jane); // oh...oh no.
System.out.println(Person.numHumans() + " humans vs. " + Person.numZombies() + " zombies.");
while (true) {
derpbie.bite(derpbie); // bored zombie is bored
}
Joe, ready for action! Bob, ready for action! Jane, ready for action! ...mmmm, brains. Oh noes, a zombie! 3 humans vs. 1 zombies. Bob is gnawed on by a zombie. The zombie formerly known as Bob bites a zombie, like an idiot. The zombie formerly known as Bob is hungry...and remembers he has an arm. Nomnomnomnom. ...etc...
Why does Object-Oriented Programming (OOP) exist?
Why is it useful? Why use OOP instead of making all code and data static?
Come up with two examples where it has utility.
Design a set of classes and objects to describe cards for the card game "War". Write "prototype" classes that include the classes, data in the classes, and methods, but do not provide an implementation of the methods.
Code written for one situation should be, within reason, reusable in other situations
Writing fairly generic classes enables this.
It is important to design your classes before writing your code. I've been doing this for you in homeworks.
Take your design from the previous Exercise.
Redesign your objects so that many of them can be reused between games
Other factors to consider: