borovaneca

PokeMon

Dec 7th, 2022
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.05 KB | None | 0 0
  1. package Fundamentals.DataTypeAndVariables.Exercises.MoreExercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class PokeMon {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int pokePower = Integer.parseInt(scanner.nextLine());
  10.         double originalValue = pokePower;
  11.         int distanceBetweenTargets = Integer.parseInt(scanner.nextLine());
  12.         int exhaustionFactor = Integer.parseInt(scanner.nextLine());
  13.         int pokes = 0;
  14.  
  15.         while (pokePower >= distanceBetweenTargets){
  16.             if ( pokePower == originalValue / 2){
  17.                 if ((originalValue / 2) / 100 == (pokePower * 1.0) / 100) {
  18.                     pokePower /= exhaustionFactor;
  19.                     continue;
  20.                 } else {
  21.                     pokePower -= distanceBetweenTargets;
  22.                 }
  23.             } else {
  24.                 pokePower -= distanceBetweenTargets;
  25.             }
  26.             pokes++;
  27.         }
  28.         System.out.println(pokePower);
  29.         System.out.println(pokes);
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment