මේකෙ Item No එක 9 input කරනකම් UI එක refresh වේවි inputs ගන්න ඔනි coding ටික හරි UI එකෙන් 9 input කරනකම් JFrame එක refresh වෙන්න හදනන ටික අවුල්
Text Fields refresh වෙන්න හැදුවත් shape 9 input කරනකම්
Text Fields refresh වෙන්න හැදුවත් shape 9 input කරනකම්
Code:
public int item(int itemNo,int qty){
switch (itemNo) {
case 1:
return 2500*qty;
case 2:
return 1500*qty;
case 3:
return 200*qty;
case 4:
return 750*qty;
default:
return 0;
}
}
public int order(int inputNo,int inputQty){
int total = 0;
total = total + item(inputNo,inputQty);
return total;
}
Code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int inputNo = Integer.parseInt(input_no.getText());
int inputQty = Integer.parseInt(input_qty.getText());
int subTotal =0;
while( inputNo !=9 || inputNo > 9){
subTotal = order(inputNo,inputQty);
}
System.out.println(subTotal);
}
