Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Fundamentals.DataTypeAndVariables.Exercises.MoreExercises;
- import java.util.Scanner;
- public class PokeMon {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int pokePower = Integer.parseInt(scanner.nextLine());
- double originalValue = pokePower;
- int distanceBetweenTargets = Integer.parseInt(scanner.nextLine());
- int exhaustionFactor = Integer.parseInt(scanner.nextLine());
- int pokes = 0;
- double calculate50 = originalValue / 2;
- double percent = (calculate50 / originalValue) * 100;
- while (pokePower >= distanceBetweenTargets){
- if ( pokePower == originalValue / 2 && percent == (pokePower / originalValue) * 100 && exhaustionFactor != 0){
- pokePower /= exhaustionFactor;
- continue;
- } else {
- pokePower -= distanceBetweenTargets;
- }
- pokes++;
- }
- System.out.println(pokePower);
- System.out.println(pokes);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment