Исключение в потоке "main" java.util.illegalformatconversionexception: d ! = java.lang.string
Exception in thread "main" java.util.IllegalFormatConversionException: d != java.lang.String at java.util.Formatter$FormatSpecifier.failConversion(Formatter.java:4302) at java.util.Formatter$FormatSpecifier.printInteger(Formatter.java:2793) at java.util.Formatter$FormatSpecifier.print(Formatter.java:2747) at java.util.Formatter.format(Formatter.java:2520) at java.io.PrintStream.format(PrintStream.java:970) at java.io.PrintStream.printf(PrintStream.java:871) at practical3.main(practical3.java:34)
Что я уже пробовал:
/** * @(#)P3Q1S.java * * * @author * @version 1.00 2020/7/3 */ import java.util.Scanner; public class practical3 { public static void main (String[] args) { Scanner scanner = new Scanner(System.in); int[] Denomination = {100,50,20,10,5,1}; int[] Quantity = new int [Denomination.length]; System.out.printf("\n\n%20s %20s\n","Denomination (RM)","Quantity"); for (int i=0;i<Denomination.length;i++) { System.out.printf("\n %20s\t\t\t\t\t",Denomination[i]); Quantity[i]=scanner.nextInt(); } int subtotal=0,total=0; System.out.printf("\n\n%20s %20s %20s\n","Denomination (RM)","Quantity","Value (RM)"); for (int i=0;i<Denomination.length;i++ ) { subtotal= Denomination[i] * Quantity[i]; System.out.printf("\n\n%20d %20d %20d\n","Denomination[i]","qty[i]","subtotal"); total+=subtotal; } System.out.println("Grand total(RM)=" +total); } }
Member 14918856
большое спасибо я уже решил эту проблему