Professional Documents
Culture Documents
Scanner;
import java.util.Random;
interface character{ //interface for character constant traits
int heal();
int consumedBottled();
int tookDamage();
int tookCrit();
int tookBossDam();
int tookBossCrit();
int damagedZom();
int damagedZomCrit();
int gunDamaged();
int gunCrit();
void driveCar();
int fBosTookDam();
int fbosTookCrit();
void bossBattle();
static int bossHealth = 150; //global variables that are not final so it can be changeable
System.out.println("you are tasked to find and rescue the president's daughter that has
been kidnapped. unusual entities are roaming "
+ "the earth which are called \nzombie\n");
System.out.print("press 1 to start game. press any other key to quit game. \n");
if(start.equals("1")) {
System.out.println("You are now deployed, you are seeing two houses. press 1
to enter first house, press 2 otherwise. ");
switch(house) {
case 1:
System.out.println("***gun acquired***");
break;
case 2:
System.out.println("THERE'S A ZOMBIE!!!");
System.out.println("1.YES 2.NO");
switch(house2Fight) {
case 1:
while(meh)
System.out.println("Your
health:" + charHealth);
System.out.println("Enemies
health: " + zomHealth + "\n");
System.out.println("press 1 to
attack. press 2 to heal. press any other key to retreat");
if(starter.equals("1")) {
int rand_int1 =
rand.nextInt(51);
int rand_int2 =
rand.nextInt(51);
if(rand_int1 <=
24) {
obj.damagedZom();
else
if(rand_int1 >= 25) {
obj.damagedZomCrit();
else {
System.out.println("You missed");
if(rand_int2 <=
24) {
else
if(rand_int2 >= 25) {
obj.tookCrit();
else {
if(zomHealth <=
0) {
meh =
false;
scan.next();
obj.heal();
obj.consumedBottled();
}
else
if(charHealth <= 0) {
charHealth = 100;
zomHealth = 100;
else if(starter.equals("2")) {
if(healthPotion <= 0) {
else {
obj.heal();
obj.consumedBottled();
System.out.println("You
only have " + healthPotion + " health potions left.");
else {
meh = false;
case 2:
System.out.println("***you went to
house 1 and acquired gun***");
break;
default:
System.out.println("\n***");
break;
break;
default:
scan.next();
obj.walk();
obj.driveCar();
while(bossbatt) {
if(bossBatt.equals("1")) {
obj.bossBattle();
bossbatt = false;
else {
healthPotion += 3;
else {
System.out.println("Quitting game.");
@Override
@Override
@Override
@Override
@Override
@Override
return healthPotion -= 1;
@Override
System.out.println("***walking***");
System.out.println("THERES A ZOMBIEE");
while(fight) {
if(starter.equals("1")) {
gunDamaged();
gunCrit();
else {
System.out.println("You missed");
tookDamage();
tookCrit();
else {
if(zomHealth <= 0) {
fight = false;
charHealth = 100;
zomHealth = 150;
else if(starter.equals("2")) {
if(healthPotion <= 0) {
else {
heal();
consumedBottled();
}
System.out.println("You only have " + healthPotion + "
health potions left.");
else {
fight = false;
@Override
@Override
@Override
}
@Override
@Override
@Override
@Override
@Override
while(fight) {
if(starter.equals("1")) {
fBosTookDam();
fbosTookCrit();
else {
System.out.println("You missed");
tookBossDam();
}
tookBossCrit();
else {
if(bossHealth <= 0) {
fight = false;
charHealth = 100;
bossHealth = 150;
else if(starter.equals("2")) {
if(healthPotion <= 0) {
else {
heal();
consumedBottled();
}
System.out.println("You only have " + healthPotion + " health potions
left.");
else {
fight = false;