-
Notifications
You must be signed in to change notification settings - Fork 4
/
SpaceBoxer.java
54 lines (42 loc) · 1.2 KB
/
SpaceBoxer.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
47
48
49
50
51
52
53
54
// Sonny Li
// CMP 167: Programming Methods I
import java.util.Scanner;
public class SpaceBoxer {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double weight;
int x;
System.out.print("Please enter your current earth weight: ");
weight = in.nextDouble();
System.out.println("\nI have information for the following planets:");
System.out.println(" 1. Venus 2. Mars 3. Jupiter");
System.out.println(" 4. Saturn 5. Uranus 6. Neptune\n");
System.out.print("Which planet are you visiting? " );
x = in.nextInt();
if (x == 1)
{
weight = weight * 0.78;
}
else if (x == 2)
{
weight = weight * 0.39;
}
else if (x == 3)
{
weight = weight * 2.65;
}
else if (x == 4)
{
weight = weight * 1.17;
}
else if (x == 5)
{
weight = weight * 1.05;
}
else if (x == 6)
{
weight = weight * 1.23;
}
System.out.printf("\nYou weight would be %.2f pounds on that planet.\n", weight);
}
}