// Guide to Java
// Copyright 2014, by J.T. Streib and T. Soma


// a program to classify and compare hurricanes

import java.util.*;

class Hurricanes {
 public static void main(String[] args) {

    // declaration and initialization of variables
    Hurricane hurricane1, hurricane2;
    int windSpeed;
    Scanner scanner;
    hurricane1 = new Hurricane();
    hurricane2 = new Hurricane();
    scanner = new Scanner(System.in);
      
    // input wind speeds and set both windSpeed and category
    System.out.print("Enter the wind speed (hurricane1): ");
    windSpeed = scanner.nextInt();
    hurricane1.setWindSpeed(windSpeed);
    hurricane1.setCategory();
    System.out.print("Enter the wind speed (hurricane2): ");
    windSpeed = scanner.nextInt();
    hurricane2.setWindSpeed(windSpeed);
    hurricane2.setCategory();
      
    // output the categories of the hurricanes
    System.out.println("Hurricane1 is category " +
                        hurricane1.getCategory());
    System.out.println("Hurricane2 is category " +
                        hurricane2.getCategory());
      
    // compare two hurricanes
    if(hurricane1.getCategory() > hurricane2.getCategory())
       System.out.print("Hurricane1 is stronger.");
    else
       System.out.print("Hurricane2 is stronger.");
 }
}


// definition of Hurricane class

class Hurricane {
 // data members
 private int windSpeed;
 private int category;
  
 // constructor
 public Hurricane() {  
    category = 0;
    windSpeed = 0;
 }

 // mutator methods
 public void setWindSpeed(int inWindSpeed) {
    windSpeed = inWindSpeed;
 }

 public void setCategory() {
    if(windSpeed > 155)
       category = 5;
    else
       if(windSpeed >= 131)
          category = 4;
       else
          if(windSpeed >= 111)
             category = 3;
          else
             if(windSpeed >= 96)
                category = 2;
             else
                if(windSpeed >= 74)
                   category = 1;
 }

 // accesor methods
 public int getWindSpeed() {
    return windSpeed;
 }

 public int getCategory() {
    return category;
 }
}