Assignment #38 Space Boxing
Code
/// Name: Koosha Kimelman
/// Period 7
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Completed: 10/2/15
import java.util.Scanner;
public class SpaceBoxing {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
double weight;
int planet;
System.out.print("Please enter your current earth weight (in pounds) : ");
weight = keyboard.nextDouble();
System.out.println();
System.out.println("I have information for the following planets:");
System.out.println(" 1. Venus 2. Mars 3. Jupiter");
System.out.println(" 4. Saturn 5. Uranus 6. Neptune");
System.out.println();
System.out.print("Which planet are you visiting (1-6) ? ");
planet = keyboard.nextInt();
System.out.println();
if (planet == 1) {
System.out.println("Your weight would be " + (weight*.78) + " pounds on that planet.");
}
else if (planet == 2) {
System.out.println("Your weight would be " + (weight*.39) + " pounds on that planet.");
}
else if (planet == 3) {
System.out.println("Your weight would be " + (weight*2.65) + " pounds on that planet.");
}
else if (planet == 4) {
System.out.println("Your weight would be " + (weight*1.17) + " pounds on that planet.");
}
else if (planet == 5) {
System.out.println("Your weight would be " + (weight*1.05) + " pounds on that planet.");
}
else if (planet == 6) {
System.out.println("Your weight would be " + (weight*1.23) + " pounds on that planet.");
}
else {
System.out.println("ERROR Please restart the program and choose a number between 1 and 6.");
}
}
}
Picture of the output