Pipes in pool проблем
import java.util.Scanner; public class demo { public static void main(String []args){ Scanner input = new Scanner(System.in); int v = Integer.parseInt(input.nextLine()); int p1 = Integer.parseInt(input.nextLine()); int p2 = Integer.parseInt(input.nextLine()); double hours = Double.parseDouble(input.nextLine()); double litersP1 = p1*hours; double litersP2 = p2*hours; double water = litersP1+litersP2; if(water <= v){ double percentfull = Math.floor(water/v*100); double percentP1 = Math.floor(litersP1/water*100); double percentP2 = Math.floor(litersP2/water*100); System.out.printf("The pool is %.0f%% full. Pipe 1: %.0f%%.Pipe 2: %.0f%%.", percentfull,percentP1,percentP2); } else{ double overflow = water-v; System.out.printf("For %.1f hours the pool overflows with %.0f liters.",hours,overflow); } } }
Judge дава оценка 80% а всички тестове са ми ок в InteliJ. Писах го по няколко различни начина ама все тая .Зациклих. Дайте идея къде гърми кода.