-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLabPart1.java
More file actions
33 lines (32 loc) · 1.03 KB
/
Copy pathLabPart1.java
File metadata and controls
33 lines (32 loc) · 1.03 KB
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
//Hi it's Nancy
import java.util.*;
public class LabPart1
{
public static void main (String [] args){
Scanner scan = new Scanner (System.in);
System.out.println("What is your current weight in pounds on Earth?");
double earthWeight = scan.nextDouble();
System.out.println("What number planet are you fighting on next");
int planet = scan.nextInt();
double planetWeight = 0;
if (planet == 1) {
planetWeight = 0.78 * earthWeight;
}
else if (planet == 2) {
planetWeight = 0.39 * earthWeight;
}
else if (planet == 3) {
planetWeight = 2.65 * earthWeight;
}
else if (planet == 4) {
planetWeight = 1.17 * earthWeight;
}
else if (planet == 5) {
planetWeight = 1.05 * earthWeight;
}
else if (planet == 6) {
planetWeight = 1.23 * earthWeight;
}
System.out.println("You weigh " + planetWeight + " lbs on that planet");
}
}