Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PlanetWeight {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- int earthWeight, planet;
- double planetWeight = 0.0;
- System.out.print("Enter your weight on Earth");
- earthWeight = keyboard.nextInt();
- System.out.println();
- System.out.println("Here are the planets");
- System.out.println(" 1. Voltar 2. Krypton 3. Fertos");
- System.out.println(" 4. Servontos");
- System.out.println();
- System.out.print("Which planet are you visiting? ");
- planet = keyboard.nextInt();
- System.out.println();
- if (planet == 1) {
- planetWeight = earthWeight * 0.091;
- } else if (planet == 2) {
- planetWeight = earthWeight * 0.720;
- } else if (planet == 3) {
- planetWeight = earthWeight * 0.865;
- } else if (planet == 4) {
- planetWeight = earthWeight * 4.612;
- } else {
- System.out.println("Enter the planet you are visting.");
- }
- System.out.println("Your weight on this planet: " + planetWeight + " pounds");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement