borovaneca

PokeM

Dec 7th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 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.         double calculate50 = originalValue / 2;
  15.         double percent = (calculate50 / originalValue) * 100;
  16.  
  17.         while (pokePower >= distanceBetweenTargets){
  18.             if ( pokePower == originalValue / 2 && percent == (pokePower / originalValue) * 100 && exhaustionFactor != 0){
  19.                     pokePower /= exhaustionFactor;
  20.                     continue;
  21.                 } else {
  22.                     pokePower -= distanceBetweenTargets;
  23.                 }
  24.  
  25.             pokes++;
  26.         }
  27.         System.out.println(pokePower);
  28.         System.out.println(pokes);
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment