Online Canteen Management System Project in Java GUI
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:
- How to Create Forgot System Password with PHP & MySQL
- Datatables Editable Add Delete with Ajax, PHP & MySQL-My programming school
- Download Login and Registration form in PHP & MySQL-MPS
- Export Data to Excel in Php Code -My programming school
- Hospital Database Management System with PHP MySQL
- Java projects for beginners | java developer software | UML diagram
- Traffic Light using Applet in Java | algorithm and source code
- Currency converter using java
- Java program to design simple calculator with the use of grid layout
- Simple Notepad Editor using java|Gui application
- Online quiz application using java GUI with complete source code
- How to create color changer mini-project using java applet with source code
- How to make a Calculator using java Swing, GUI
- Canteen food order, generate total bill using java swing
- Currency Convertor java project, swing component
- Python Number Guessing Game mini Project
See my more website