If Statement #37 (No comment)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 10/15/2015
import java.util.Scanner;
public class SpaceBoxing {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int earthWeight, chose;
double venus, mars, jupitar, saturn, uranus, neptune;
venus = 0.78;
mars = 0.39;
jupitar = 2.65;
saturn = 1.17;
uranus = 1.05;
neptune = 1.23;
System.out.println("Please enter your current earth weight: ");
earthWeight = input.nextInt();
System.out.println("I have information for the following planets:");
System.out.println( "\t1. Venus 2. Mars 3.Jupiter");
System.out.println( "\t4. Saturn 5. Uranus 6. Neptune");
System.out.println();
System.out.print("Which planet are you visiting? ");
chose = input.nextInt();
if (chose == 1) {
System.out.println("Your weight would be " + (venus * earthWeight) + " pounds on that planet.");
}
else if (chose == 2) {
System.out.println("Your weight would be " + (mars * earthWeight) + " pounds on that planet.");
}
else if (chose == 3) {
System.out.println("Your weight would be " + (jupitar * earthWeight) + " pounds on that planet.");
}
else if (chose == 4) {
System.out.println("Your weight would be " + (saturn * earthWeight) + " pounds on that planet.");
}
else if (chose == 5) {
System.out.println("Your weight would be " + (uranus * earthWeight) + " pounds on that planet.");
}
else if (chose == 6) {
System.out.println("Your weight would be " + (neptune * earthWeight) + " pounds on that planet.");
}
else {
System.out.println("INVALID OPTION!");
}
}
}
Picture of the output