Привет,
Подобно на колегата от JS , кодът работи в IntelliJ, но ми дава wrong answer като го събмитна тук. Някой има ли идея защо?
public class PhoneBill {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
int messages = Integer.parseInt(input);
input = scanner.nextLine();
int minutes = Integer.parseInt(input);
int additionalMessages = 0;
if (messages > 20) {
additionalMessages = messages - 20;
}
int additionalMinutes = 0;
if(minutes > 60) {
additionalMinutes = minutes - 60;
}
double additionalMessagesPrice = additionalMessages * 0.06;
double additionalMinutesPrice = additionalMinutes * 0.10;
double tax = (additionalMinutesPrice + additionalMessagesPrice) * 0.20;
double total = 12 + additionalMessagesPrice + additionalMinutesPrice + tax;
System.out.printf("%d additional messages for %.2f levas%n", additionalMessages, additionalMinutesPrice);
System.out.printf("%d additional minutes for %.2f levas%n", additionalMinutes, additionalMinutesPrice);
System.out.printf("%.2f additional taxes%n", tax);
System.out.printf("%.2f total bill%n", total);
}
}