Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //(c) A+ Computer Science
- //www.apluscompsci.com
- //Name -
- import java.util.*;
- 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 : ");
- String name = keyboard.next();
- System.out.println("Enter 1st monster's size : ");
- int size = keyboard.nextInt();
- //instantiate monster one
- Monster mOne = new Monster(name, size);
- //ask for name and size
- System.out.println("Enter 2nd monster's name :");
- name = keyboard.next();
- System.out.println("Enter 2nd monster's size :");
- size = keyboard.nextInt();
- //instantiate monster two
- Monster mTwo = new Monster(name, size);
- if (mOne.isBigger(mTwo)== true)
- {
- System.out.println("Monster one is bigger than Monster two.");
- }
- else if(mOne.isSmaller(mTwo)==true)
- {
- System.out.println("Monster one is smaller than Monster two.");
- }
- if (mOne.namesTheSame(mTwo)==true)
- {
- System.out.println("Monster one has the same name as Monster two.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement