Canteen Management System Project in Java GUI Mini Project

Online Canteen Management System Project in Java GUI

 
 
Here you can select food categories and number of item  then after order you can generate total bill 

Canteen Management Software Source Code:

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import java.io.*;
public class CanteenT implements ActionListener

JFrame f;
JTabbedPane tb;
CanteenT()
{
f=new JFrame(“Canteen”);
tb=new JTabbedPane();
f.setVisible(true);
f.setSize(1500,1500);
tb.addTab(“Veg”,new Veg());
tb.addTab(“Nonveg”,new Nonveg());
tb.addTab(“Bill”,new Bill());
f.add(tb);
}
public void actionPerformed(ActionEvent ae)
{
}
public static void main(String…aa)
{
new CanteenT();
}
}

class Veg extends JPanel implements ActionListener
{
JButton b1;
JLabel l1,l2,l3,l4;
JTextField t1,t2;
Veg()
{
b1=new JButton(“Bill”);
l1=new JLabel(“Idli:25 “);
l2=new JLabel(“Dosa:30”);
l3=new JLabel(“Enter quantity”);
l4=new JLabel(“Enter quantity”);
t1=new JTextField(10);
t2=new JTextField(10);
add(l1);
add(l3);
add(t1);
add(l2);
add(l4);
add(t2);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource().equals(b1))
{int c;
int a=Integer.parseInt(t1.getText());
int b=Integer.parseInt(t2.getText());
c=(a*25)+(b*30);
String h=String.valueOf(c);
try
{
FileWriter x=new FileWriter(“bill1.txt”);
{
x.write(h);
x.close();
}
}
catch(IOException jj)
{}
}
}
}
class Nonveg extends JPanel implements ActionListener
{
JButton b1;
JLabel l1,l2,l3,l4;
JTextField t1,t2;
Nonveg()
{
b1=new JButton(“Bill”);
l1=new JLabel(“Chicken:150 “);
l2=new JLabel(“Mutton:430”);
l3=new JLabel(“Enter quantity”);
l4=new JLabel(“Enter quantity”);
t1=new JTextField(10);
t2=new JTextField(10);
add(l1);
add(l3);
add(t1);
add(l2);
add(l4);
add(t2);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource().equals(b1))
{int c1;
int a1=Integer.parseInt(t1.getText());
int b1=Integer.parseInt(t2.getText());
c1=(a1*150)+(b1*430);
String h1=String.valueOf(c1);
try
{
FileWriter y=new FileWriter(“bill2.txt”);
{
y.write(h1);
y.close();
}
}
catch(IOException jj)
{}
}
}
}
class Bill extends JPanel implements ActionListener
{
JLabel l1;
JTextField t1;
JButton b1;
Bill()
{
l1=new JLabel(“Your bill is”);
t1=new JTextField(10);
b1=new JButton(“Bill”);
add(l1);
add(t1);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource().equals(b1))
{try
{
InputStream is=new FileInputStream(“bill1.txt”);
BufferedReader buf=new BufferedReader(new InputStreamReader(is));
String hjk=buf.readLine();
int kk=Integer.parseInt(hjk);
InputStream is1=new FileInputStream(“bill2.txt”);
BufferedReader buf1=new BufferedReader(new InputStreamReader(is1));
String k=buf1.readLine();
int jk=Integer.parseInt(k);
int f=kk+jk;
t1.setText(String.valueOf(f));
}
catch(Exception fd)
{}
}
}
}

COMPLETED PROJECTS:

See my more website

Pramod Kumar Yadav is from Janakpur Dham, Nepal. He was born on December 23, 1994, and has one elder brother and two elder sisters. He completed his education at various schools and colleges in Nepal and completed a degree in Computer Science Engineering from MITS in Andhra Pradesh, India. Pramod has worked as the owner of RC Educational Foundation Pvt Ltd, a teacher, and an Educational Consultant, and is currently working as an Engineer and Digital Marketer.



Leave a Comment