0
학교 프로젝트 (첫 번째 Java 과정)를 마치고 JOptionPane
만을 사용해야한다고 들었습니다. 나는 System.out.println
하지만이 JOptionPane
를 사용하여이없이 같은 것을 수행해야합니다JOptionPane 내부에서 배열을 반복 처리하고 사용자 정의 메시지를 표시하는 방법
int[] den = {1000, 500, 100 ,50, 20, 10 ,5, 2, 1};
System.out.println("\nDENOMINATIONS: \n");
for (int i = 0; i < 9; i++) {
count = amount/den[i]; // counting number of den[i] notes
if (count != 0) { //printing that denomination if the count is not zero
System.out.println(den[i] + "\tx\t" + count + "\t= " + den[i] * count);
}
totalNotes = totalNotes + count; //finding the total number of notes
amount = amount%den[i]; //finding the remaining amount
}
System.out.println("--------------------------------");
System.out.println("TOTAL\t\t\t= " + copy);
System.out.println("--------------------------------");
System.out.println("Total Number of Notes\t= " + totalNotes);
:
DENOMINATIONS:
1000 x 14 = 14000
500 x 1 = 500
100 x 3 = 300
50 x 1 = 50
5 x 1 = 5
1 x 1 = 1
————————————–
TOTAL = 14856
————————————–
Total Number of Notes = 21
나는'JTable'을 생각하고있다. – MadProgrammer