abstract class Being { int life, energy, attack, defense; Being() { this.life = 10; this.energy = 10; } Being(int life) { this.life = life; this.energy = 10; } public abstract int attack(Being b); } class Human extends Being { public int attack(Being b) { int dmg = attack - b.defense; dmg = (dmg < 0) ? 0 : dmg; b.life = life - dmg; return dmg; } } class Game { public static void main(String[] args) { Human tom = new Human(); Human stan = new Human(); tom.attack = 3; tom.defense = 3; stan.attack = 5; stan.defense = 5; System.out.printf("tom life: %s\n", tom.life); System.out.printf("stan life: %s\n", stan.life); System.out.printf("tom attacks stan for %s damage!\n", tom.attack(stan)); System.out.printf("tom life: %s\n", tom.life); System.out.printf("stan life: %s\n", stan.life); System.out.printf("stan attacks tom for %s damage!\n", stan.attack(tom)); System.out.printf("tom life: %s\n", tom.life); System.out.printf("stan life: %s\n", stan.life); } }