Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
900 B
4
Indexable
Never
    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);


        }
    
Leave a Comment