Untitled
unknown
plain_text
2 years ago
900 B
10
Indexable
void additem(){
int quantity = Integer.parseInt(JOptionPane.showInputDialog("Enter the Quantity: "));
double total = price * quantity;
tAmount1 = String.format ("%.02f", total);
model = (DefaultTableModel) myTable.getModel();
model.addRow(new Object[]{
name,
price,
quantity,
tAmount1,});
double totalAmount =0;
for (int idx = 0; idx < myTable.getRowCount(); idx++) {
totalAmount = totalAmount + Double.parseDouble(myTable.getValueAt(idx, 3).toString());
}
tAmount2 = String.format("%.02f", totalAmount);
jTextField1.setText ("PHP" + tAmount2);
PlaceOrder PlaceOrderFrame = new PlaceOrder();
PlaceOrderFrame.setVisible (true);
}
Editor is loading...
Leave a Comment