Advertisement
Strade351

Task 5.1.4

Jul 9th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. /**
  2.  * Created by Anatoliy on 10.07.2016.
  3.  * Task 5.1.4
  4.  */
  5. import java.util.Scanner;
  6.  
  7. public class Task8 {
  8.     public static void main(String[] args) {
  9.         Scanner in = new Scanner(System.in);
  10.         String planetName = null;
  11.         double weight = in.nextDouble();
  12.         System.out.println("1. Mercury");
  13.         System.out.println("2. Venus");
  14.         System.out.println("3. Mars");
  15.         System.out.println("4. Jupiter");
  16.         System.out.println("5. Saturn");
  17.         System.out.println("6. Uranus");
  18.         System.out.println("7. Neptune");
  19.         int num = in.nextInt();
  20.         if (num == 1) {
  21.             weight = weight * 0.38;
  22.             planetName = "Меркурий";
  23.         }
  24.  
  25.         if (num == 2) {
  26.             weight = weight * 0.91;
  27.             planetName = "Венера";
  28.         }
  29.  
  30.         if (num == 3) {
  31.             weight = weight * 0.38;
  32.             planetName = "Марсе";
  33.         }
  34.  
  35.         if (num == 4) {
  36.             weight = weight * 2.36;
  37.             planetName = "Юпитер";
  38.         }
  39.  
  40.         if (num == 5) {
  41.             weight = weight * 0.92;
  42.             planetName = "Сатурн";
  43.         }
  44.  
  45.         if (num == 6) {
  46.             weight = weight * 0.89;
  47.             planetName = "Уран";
  48.         }
  49.  
  50.         if (num == 7) {
  51.             weight = weight * 1.13;
  52.             planetName = "Нептун";
  53.         }
  54.  
  55.         System.out.println("На пленете " + planetName + " ваш вес будет равен " + weight + "кг");
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement