Calling Class Methods Homework
Homework: Ultimate Battle
Scenario
You are programming a game where 2 objects of your choosing (e.g., Robots, Dinosaurs, People) battle. Each object has health and power.
Instructions
-
Create a class representing your object with:
Instance variables:
String nameint powerint healthMAKE YOUR OWN
Static variables:
double fightDuration
Instance methods:
void attack()void printStatus()MAKE YOUR OWN
Class methods:
static int strongerFighter()static void beginBattle()MAKE YOUR OWN
-
In
main:- Create two objects.
- Use instance methods to attack and print status.
- Use static methods to compare, print a fact, and start the battle.
// Code Here