-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugNine4.java
More file actions
20 lines (19 loc) · 665 Bytes
/
DebugNine4.java
File metadata and controls
20 lines (19 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import java.util.Scanner;
public class DebugNine4
{
enum Planet {MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE};
public static void main(String[] args)
{
Planet planet;
String userEntry
int position;
int comparison;
Scanner input = new Scanner(System.in);
System.out.print("Enter a planet in our solar system >> ");
userEntry = input.nextLine().toUpperCas();
planet = Planet.valueOf(userEnttry);
System.out.println("You entered " + planet);
pos = planet.ordinal();
System.out.println(planet + " is " + position + 1 + " planet(s) from the sun");
}
}