Untitled

 avatar
unknown
plain_text
a year ago
900 B
7
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