# [AtCoder Problem-ABC001] C-Do wind observation in Java [Code]

## Introduction

Now that I have completed my studies of Java-Silver, I tried "AtCoder Problem" which can output for free. I will leave a memorandum on Qiita!

## problem

Since the problem statement is long, please use here.

## code

#### `TorT.java`

``````
import java.util.Scanner;

public class WindObservation {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double wind_direction = sc.nextInt();

wind_direction = wind_direction / 10;

double Wind = sc.nextInt();
Wind = Wind / 60;
Wind = ((double)Math.round(Wind * 10))/10;

System.out.println(Direction(wind_direction));
System.out.println(Amount(Wind));

}

public static String Direction(double direction){
String master = "";
if((11.25 <= direction) && (direction < 33.75)){
master = "N";
}else if((33.75 <= direction) && (direction < 56.25)){
master = "NE";
}else if((56.25 <= direction) && (direction < 78.75)){
master = "ENE";
}else if((78.75 <= direction) && (direction < 101.25)){
master = "E";
}else if((101.25 <= direction) && (direction < 123.75)){
master = "ESE";
}else if((123.75 <= direction) && (direction < 146.25)){
master = "SE";
}else if((146.25 <= direction) && (direction < 168.75)){
master = "SSE";
}else if((168.75 <= direction) && (direction < 191.25)){
master = "S";
}else if((191.25 <= direction) && (direction < 213.75)){
master = "SSW";
}else if((213.75 <= direction) && (direction < 236.25)){
master = "SW";
}else if((236.25 <= direction) && (direction < 258.75)){
master = "WSW";
}else if((258.75 <= direction) && (direction < 281.25)){
master = "W";
}else if((281.25 <= direction) && (direction < 303.75)){
master = "WNW";
}else if((303.75 <= direction) && (direction < 326.25)){
master = "NW";
}else if((326.25 <= direction) && (direction < 348.75)){
master = "NNW";
}else{
master = "N";
}
return master;
}

public static int Amount(double wind){

int i = 0;

if((0.0 <= wind) && (wind < 0.2)){
i = 0;
}else if((0.3 <= wind) && (wind < 1.5)){
i = 1;
}else if((1.6 <= wind) && (wind < 3.3)){
i = 2;
}else if((3.4 <= wind) && (wind < 5.4)){
i = 3;
}else if((5.5 <= wind) && (wind < 7.9)){
i = 4;
}else if((8.0 <= wind) && (wind < 10.7)){
i = 5;
}else if((10.8 <= wind) && (wind < 13.8)){
i = 6;
}else if((13.9 <= wind) && (wind < 17.1)){
i = 7;
}else if((17.2 <= wind) && (wind < 20.7)){
i = 8;
}else if((20.8 <= wind) && (wind < 24.4)){
i = 9;
}else if((24.5 <= wind) && (wind < 28.4)){
i = 10;
}else if((28.5 <= wind) && (wind < 32.6)){
i = 11;
}else{
i = 12;
}
return i ;
}

}
``````

Please forgive me that the code is verbose and the variable names are messy. I would like to write the original code of the spirit that "I should move first" and improve the quality of the code from now on.

``````\$ java WindObservation
> 2750
> 628
W
5
``````
``````\$ java WindObservation
> 1687
> 1029
SSE
8
``````

It's working, so it's safe! !! !!

I will output it with AtCoder Problem for a while. When Corona calms down, I would like to take Java-Silver and challenge Gold.