0

I may be just overlooking some things, but I can't figure out how to connect my runner file to my starter file so I can run this code.

The goal of this is to write a Monster class that stores the name and size of a Monster and compare two monsters to see which is biggest and which is smallest.

Below is the code I currently have for the starter and runner files.

Starter file:

import static java.lang.System.*;
public class Monster
{
    private String name;
    private int howBig; 
    char Monsterone;
    char Monstertwo;

    public Monster()
    {
        Monsterone = Monsterone;
        Monstertwo = Monstertwo;
    }

    public Monster(String n, int size)
    {
        size = size;
        name = n;
    }

    public String getName()
    {
        return "";
    }

    public int getHowBig()
    {
        return 0;
    }

    public boolean isBigger(Monster other)
    {
        if(Monsterone > Monstertwo)
        {
            return true;
        }
        return false;
    }

    public boolean isSmaller(Monster other)
    {
        //call isBigger() use !
       if(Monsterone < Monstertwo)
        {
            return false;
        }
        return true;
    }

    public boolean namesTheSame(Monster other)
    {
        return false;
    }

    public String toString()
    {
        return "Monster one is" + getHowBig() + "than Monster two.";
    }
}

Runner file:

import java.util.Scanner;
import static java.lang.System.*;

public class MonsterRunner
{
    public static void main( String args[] )
    {
        Scanner keyboard = new Scanner(System.in);

        //ask for name and size

        System.out.println("Enter 1st monster's name::");
        char valuee = keyboard.next().charAt(0);

        System.out.println("Enter 1st monster's size::");
        int valueone = keyboard.nextInt();

        //instantiate monster one

        //ask for name and size

        System.out.println("Enter 2nd monster's name::");
        char valueeone = keyboard.next().charAt(0);

        System.out.println("Enter 2nd monster's size::");
        int valuetwo = keyboard.nextInt();

        //instantiate monster two
    }
}
S.Bnk
  • 1
  • Possible duplicate of [How does Java import work?](https://stackoverflow.com/questions/12620369/how-does-java-import-work) – Brien Foss Feb 25 '18 at 23:19

1 Answers1

0

You need to import the one class into other other class.

SANM2009
  • 1,918
  • 2
  • 12
  • 30