Здравейте. Имам проблем със задачата. Не мога да открия грешката си.
https://pastebin.com/raw/rvCU8pns
Условието е
A phone bill plan includes 1 hour of free calls
and 20 text messages
for 12.00 levas
. Each additional minute costs 0.10 levas
and each additional message costs 0.06 levas
. Also, any additional minutes/text messages are subject to 20%
sales tax. Write a program that calculates the additional charge for text, the additional charge for minutes, and the sales tax charge for both. Also, display the total amount paid.
Input
- On the first line, you will receive the total amount of text messages.
- On the second line, you will receive the total amount of minutes.
Output
- 1st line - number of additional messages and additional amount paid
- 2nd line - number of additional minutes and additional amount paid
- 3rd line - amount paid in taxes
- 4th line - total bill
Input
31
115
Output
11 additional messages for 0.66 levas
55 additional minutes for 5.50 levas
1.23 additional taxes
19.39 total bill
Input
18
44
Output
0 additional messages for 0.00 levas
0 additional minutes for 0.00 levas
0.00 additional taxes
12.00 total bill
Здравей,
Offtopic: Можеш да използваш директно Integer.parseInt(scanner.nextLine());
Какъв е проблемът със задачата? Защото на мен ми изглежда ok. Единствено, че аз бих използвала int за extraMessages и extraMinutes.
Каква грешка ти дава?
ubmission Info
Status: Wrong Answer
Language: Java
Points: 0
Time: 0.2 s
Memory: 27.9 MB
Date: 08/09/2021 11:19
Test cases
Test case #1: Wrong Answer [0.2 s, 27.9 MB]
Your output (clipped)
11 additional messages for 0.66 levas
55 additional minutes for
Test case #2: Wrong Answer [0.2 s, 27.9 MB]
Your output (clipped)
0 additional messages for 0.00 levas
0 additional minutes for 0.
Test case #3: Wrong Answer [0.2 s, 27.9 MB]
Your output (clipped)
1 additional messages for 0.06 levas
1 additional minutes for 0.
Test case #4: Wrong Answer [0.2 s, 27.9 MB]
Your output (clipped)
5 additional messages for 0.30 levas
0 additional minutes for 0.
Test case #5: Wrong Answer [0.2 s, 27.9 MB]
Your output (clipped)
0 additional messages for 0.00 levas
5 additional minutes for 0.
Здравей,
Кодът ти е ок, само имаш правописна грешка в предпоследния ред:
System.out.printf("%.2f additional taxex%n", tax);
Трябва да е ‘taxes’, а не ‘taxex’ и имаш 100/100
Благодаря. Явно съм по сляп от колкото предполагах.