Back to home

import java.util.*;

public class MarioDriver {
public static void main (String args[]) {
Mario mario = new Mario(); // init new Mario mario
System.out.println("Mario's name: " + mario.getName() + "\n"); // print out the name of mario
Scanner a = new Scanner(;
System.out.println("Enter a new name");
mario.setName(a.nextLine()); // set the name of mario to "Luigi"
System.out.println("\nAdding a few items to the inventory...\n");
mario.addItem(new InventoryItem(90.0, true, new String[] {"Excalibur", "that really fancy sword"})); // add InventoryItems to mario
mario.addItem(new InventoryItem(100.0, true, new String[] {"Other Excalibur", "the other really fancy sword"}));
mario.addItem(0, new InventoryItem(2.0, false, new String[] {"paper", "its literally just paper"}));
System.out.println(mario.getItemWithMaxAttack()); // get the item with the highest attack from mario's inventory with its getItemWithMaxAttack() method
mario.attackWithWeapon(); // call the attackWithWeapon() method
System.out.println("\nAttack with the strongest weapon...");
System.out.println(mario); // print out mario using its toString() method
System.out.println("\nSorting inventory...\n");
System.out.println("Renaming the character automatically...\n");
System.out.println(mario.giveMeAnotherName()); // rename mario with its giveMeAnotherName() method
System.out.println("\nClearing the inventory...\n");
System.out.println(mario.clearInventory()); // clear mario's inventory using its clearInventory() method
System.out.println(mario); // print out mario using its toString() method
// #23 - Polymorhpism
GameCharacter enemy = new Enemy();
System.out.println("Enemy position: " + enemy.getPosition() + "\n");
Scanner b = new Scanner(;
System.out.println("Name the enemy");
System.out.println("\nEnemy name:" + enemy.getName());
} // end main method
} // end class