-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeasons.java
46 lines (38 loc) · 1.01 KB
/
Seasons.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//Seasons.java
import java.util.Scanner;
/**
This program translates the English names of
the seasons into Spanish
*/
public class Seasons
{
public static void main(String[] args)
{
String input;
// Create a Scanner object for keyboard input.
Scanner keyboard = new Scanner(System.in);
// Get a day from the user.
System.out.print("Enter the name of a season: ");
input = keyboard.nextLine();
// Translate the season to Spanish.
switch (input)
{
case "spring":
System.out.println("la primavera");
break;
case "summer":
System.out.println("el verano");
break;
case "autumn":
case "fall":
System.out.println("el otono");
break;
case "winter":
System.out.println("el invierno");
break;
default:
System.out.println("Please enter one of these words:\n"
+ "spring, summer, autumn, fall, or winter.");
}
}
}