This tutorial will teach you how to make a Cake Shop Inventory Management System in Java step by step. This system will helpful you to learn Inventory Management System.



Paste the Code inside the Add Button
int sum = 0;
if(chkCho.isSelected())
{
String cho = "Chocolate cake";
int price = 1000;
int qty = Integer.parseInt(txtCqty.getText());
int tot = price * qty;
model = (DefaultTableModel)jTable1.getModel();
model.addRow(new Object[]
{
cho,
price,
qty,
tot
}
);
}
if(chkRed.isSelected())
{
String crispy = "Red velvet cake";
int price = 1200;
int qty = Integer.parseInt(txtRqty.getText());
int tot = price * qty;
model = (DefaultTableModel)jTable1.getModel();
model.addRow(new Object[]
{
crispy,
price,
qty,
tot
}
);
}
if(chkCup.isSelected())
{
String hotdeal = "Cupcake";
int price = 500;
int qty = Integer.parseInt(txtCupqty.getText());
int tot = price * qty;
model = (DefaultTableModel)jTable1.getModel();
model.addRow(new Object[]
{
hotdeal,
price,
qty,
tot
}
);
}
for(int i=0; i<jTable1.getRowCount(); i++)
{
sum = sum + Integer.parseInt(jTable1.getValueAt(i, 3).toString());
}
txtbill.setText(Integer.toString(sum));i have attached the video link below. which will do this tutorials step by step