+ 1

why is giving error

import java.util.Scanner; public class CalculadoraPropinas { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Ingrese el importe de la factura: "); double factura = sc.nextDouble(); // Cálculo del 15%: (factura * 15) / 100 double propina = (factura * 15) / 100; System.out.printf("La propina es: %.2f%n", propina); sc.close(); } }

18th Aug 2025, 4:26 PM
Unknown Coder
Unknown Coder - avatar
3 Respostas
+ 5
Unknown Coder , please complete your post with some more details: > what input value did you use? > is it a programming error (program stops running with an error message), or is it a logical issue (wrong result, no result,...)? > just mention an input sample value and what output do you expect to get.
18th Aug 2025, 5:31 PM
Lothar
Lothar - avatar
+ 2
In the last printf statement you have two specifiers ("%.2f" and "%n") but only one argument ("propina"). What was the example of the output you intended to get?
26th Aug 2025, 9:25 AM
Евгений
Евгений - avatar
+ 1
Unknown Coder did it solve your problem?
26th Aug 2025, 11:25 AM
Евгений
Евгений - avatar