Hotel Report Source Code

Hotel Report

 

Spardhavani.com Android App Download Now Click Here

spardhavani andriod app

Source Code:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

public class Hotel extends JFrame implements ActionListener

{

JPanel p,p1,p2,p3,lgn,cst,regn,bkng,room,bill,main,thnx,mnu,cart,enq;

GridBagLayout gb;

CardLayout cl;

GridBagConstraints gbc;

MyWinLis wl;

MyFocusLis ff;

Connection con;

Statement st;

PreparedStatement ps;

ResultSet rs;

Font mfnt,mfnt1;

)

 

Initializing Customer Form Objects

l3=new JLabel(“Customer Code”);

l4=new JLabel(“Last Name”);

l5=new JLabel(“First Name”);

l6=new JLabel(“Sex”);

l7=new JLabel(“Age”);

l8=new JLabel(“Maritial status”);

l9=new JLabel(“Nationality”);

l10=new JLabel(“Country”);0

l11=new JLabel(“PassPort No.”);

l12=new JLabel(“Visa No.”);

l13=new JLabel(“Residential Address”);

l14=new JLabel(“Official Address(if any)”);

l15=new JLabel(“Phone No.”);

l16=new JLabel(“Email ID”);

l17=new JLabel(“Status”);

l17a=new JLabel(”                    “);

l3.setFont(mfnt1);

l4.setFont(mfnt1);

l5.setFont(mfnt1);

l6.setFont(mfnt1);

l7.setFont(mfnt1);

l8.setFont(mfnt1);

l9.setFont(mfnt1);

l10.setFont(mfnt1);

l11.setFont(mfnt1);

l12.setFont(mfnt1);

l13.setFont(mfnt1);

l14.setFont(mfnt1);

l15.setFont(mfnt1);

l16.setFont(mfnt1);

l17.setFont(mfnt1);

t3=new JTextField(10);

t4=new JTextField(10);

t5=new JTextField(10);

t6=new JTextField(5);

t7=new JTextField(10);

t8=new JTextField(10);

t9=new JTextField(10);

t10=new JTextField(15);

t11=new JTextField(20);

ta1=new JTextArea(5,10);

ta2=new JTextArea(5,10);

cb1=new JComboBox();

cb1.addItem(“New”);

cb1.addItem(“Occasional”);

cb1.addItem(“Regular”);

cb1.addItem(“BlackListed”);

r1=new JRadioButton(“Male”);

r2=new JRadioButton(“Female”);

r3=new JRadioButton(“Married”);

r4=new JRadioButton(“Unmarried”);

r5=new JRadioButton(“Indian”);

r6=new JRadioButton(“Foreigner”);

b4=new JButton(“Save Details”);

b5=new JButton(“Back to Main”);

b4.addActionListener(this);

b5.addActionListener(this);

il=new MyItemLis();

r1.addActionListener(this);

r2.addActionListener(this);

r3.addActionListener(this);

r4.addActionListener(this);

r5.addActionListener(this);

r6.addActionListener(this);

r5.addItemListener(il);

r6.addItemListener(il);

cst.setLayout(gb);

t7.setEnabled(false);

t8.setEnabled(false);

t9.setEnabled(false);

addCustomer(l58,1,1,4,1);

addCustomer(l59,1,2,1,1);

addCustomer(l3,2,4,1,1);

addCustomer(l4,2,5,1,1);

addCustomer(t4,4,5,1,1);

addCustomer(l5,2,6,1,1);

addCustomer(t5,4,6,1,1);

addCustomer(l6,2,7,1,1);

addCustomer(l7,2,8,1,1);

addCustomer(l8,2,9,1,1);

addCustomer(l9,2,10,1,1);

addCustomer(l10,2,11,1,1);

addCustomer(l11,2,12,1,1);

addCustomer(l12,2,13,1,1);

addCustomer(l13,2,14,1,1);

addCustomer(l14,2,16,1,1);

addCustomer(l15,2,18,1,1);

addCustomer(l16,2,19,1,1);

addCustomer(l17,2,20,1,1);

addCustomer(l17a,3,4,1,1);

addCustomer(t3,4,4,1,1);

p1.add(r1);

p1.add(r2);

addCustomer(p1,4,7,1,1);

addCustomer(t6,4,8,1,1);

p2.add(r3);

p2.add(r4);

addCustomer(p2,4,9,1,1);

p3.add(r5);

p3.add(r6);

addCustomer(p3,4,10,1,1);

addCustomer(t7,4,11,1,1);

addCustomer(t8,4,12,1,1);

addCustomer(t9,4,13,1,1);

addCustomer(ta1,4,14,1,1);

addCustomer(ta2,4,16,1,1);

addCustomer(t10,4,18,1,1);

addCustomer(t11,4,19,1,1);

addCustomer(cb1,4,20,1,1);

addCustomer(b4,2,21,1,1);

addCustomer(b5,4,21,1,1);

}

 

public void addCustomer(Component cc,int col,int r,int w,int h)

{

gbc.gridx=col;

gbc.gridy=r;

gbc.gridwidth=w;

gbc.gridheight=h;

gb.setConstraints(cc,gbc);

cst.add(cc);

}

public void actionPerformed(ActionEvent ee)

{

if(ee.getSource()==b1)

{

try

{

ps=con.prepareStatement(“Select * from Users where UserName=? and Password=?”);

ps.setString(1,t1.getText());

ps.setString(2,t2.getText());

rs=ps.executeQuery();

t1.setText(“”);

t2.setText(“”);

rs.next();

t1.setText(rs.getString(1));

t2.setText(rs.getString(2));

cl.show(p,”Main”);

}

catch(Exception e)

{

t1.setText(“Illegal User Name or Password”);

t2.setText(“”);

}

}

if(ee.getSource()==b2)

{

System.exit(0);

}

if(ee.getSource()==b3)

{

cl.show(p,”Registration”);

}

if(ee.getSource()==b4)

{

try

{

ps=con.prepareStatement(“Insert into Customer values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)”);

ps.setString(1,t3.getText());

ps.setString(2,t4.getText());

ps.setString(3,t5.getText());

if(r1.isSelected())

{

ps.setString(4,”Male”);

}

else

{

ps.setString(4,”Female”);

}

ps.setInt(5,Integer.parseInt(t6.getText()));

if(r3.isSelected())

{

ps.setString(6,”Married”);

}

else

{

ps.setString(6,”Unmarried”);

}

if(r5.isSelected())

{

ps.setString(7,”Indian”);

}

else

{

ps.setString(7,”Foreigner”);

}

ps.setString(8,t7.getText());

ps.setString(9,t8.getText());

ps.setString(10,t9.getText());

ps.setString(11,ta1.getText());

ps.setString(12,ta2.getText());

ps.setString(13,t10.getText());

ps.setString(14,t11.getText());

ps.setString(15,(String)cb1.getSelectedItem());

int i;

i=ps.executeUpdate();

t3.setText(“Customer details successfully added”);

t4.setText(“”);

t5.setText(“”);

r1.setSelected(true);

r2.setSelected(false);

t6.setText(“”);

r3.setSelected(false);

r4.setSelected(true);

r5.setSelected(true);

r6.setSelected(false);

t7.setText(“”);

t8.setText(“”);

t9.setText(“”);

ta1.setText(“”);

ta2.setText(“”);

t10.setText(“”);

t11.setText(“”);

}

catch(Exception e)

{

t3.setText(“Error in adding Customer details”);

}

}

if(ee.getSource()==b5)

{

cl.show(p,”Main”);

}

if(ee.getSource()==b6)

{

try

{

ps=con.prepareStatement(“Insert into Users values(?,?)”);

String str1,str2;

str1=t13.getText();

str2=t14.getText();

if(str1.equals(str2))

{

ps.setString(1,t12.getText());

ps.setString(2,t13.getText());

int i=ps.executeUpdate();

t12.setText(“UserName successfully added”);

t13.setText(“”);

t14.setText(“”);                                                }

else

{

t12.setText(“Please retype your UserName And Password correctly”);

}

}

catch(Exception e)

{

t12.setText(“Error in  making new account”);

}

}

OUT PUT

Customer Form:-

Customer Form

 

OUT PUT

 

Billing Form:-

Billing Form

Enquiry Form:-

Enquiry Form

Ready Project Buy Now Online  Rs 55/-  CLICK HERE

BUY NOW

spardhavani fb page spardhavani andriod app spardhavani youtube Spardhavani Twitter

 

259 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by wp-copyrightpro.com