AJP Mircroproject (Final)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Advance Java Programming (22517) Hotel Management System

A
Micro-Project Report
On

“Hotel Management System”

Submitted By

Jidnyasa Chavan (23)

Under Guidance Of
Ms. Anuja Mate
Diploma Course in Computer Technology
(As per directives of I Scheme, MSBTE)

Sinhgad Technical Education Society’s


SOU. VENUTAI CHAVAN POLYTECHNIC, PUNE -411046
The Academic Year 2022– 2023

1
Advance Java Programming (22517) Hotel Management System

MAHARASHTRA STATE BOARD OF

TECHNICAL EDUCATION

Certificate
This is to certify that Mast /Ms. Jidnyasa Chavan Roll No. 25 of Semester V of Diploma in

Computer Technology of Institute STES’s Sou. Venutai Chavan Polytechnic (Code: 0040)

has completed the Micro Project satisfactorily in Subject Advance Java programming

(22517) for the academic year 2022 – 2023 as prescribed in the curriculum.

Program Code: CM Course Code: CM/5/I

Place: Pune Enrollment No: 2000400244

Date: Exam. Seat No:

(Ms. Anuja Mate) (Mrs.A.V.Kurkute) (Dr.M.S.Jadhav)


Subject Teacher Head of Department Principal

2
Advance Java Programming (22517) Hotel Management System

Sr.No Contents Pg.No.

1. Aim of the Microproject 1

2. Rationale 3

3. Course Outcomes achieved 3

4. Literature Review 3

5. Actual Methodology Followed 4

6. Actual Resources Used 5

7. Skills Developed 15

8. Applications 15

3
Advance Java Programming (22517) Hotel Management System

Annexure – I
Micro-Project Proposal
Hotel Management System

1.0 Aim of the Micro – Project:


This Micro-Project aims at developing a program for ‘Hotel Management System,
using Advance Java Programming.

2.0 Intended Course Outcomes:


a. Develop programs using GUI framework (AWT and Swing).
b. Handle events of AWT and Swing components
c. Develop programs to handle events in Java programming.
d. Develop programs using database.

3.0 Proposed Methodology:


This Micro-Project aims at developing a program for ‘Hotel Management System’ using
Advance Java Programming.
1. Study all the concepts of Advance Java Programming.
2. Identify the requirements of project.
3. Prepare coding for the project and get output after executing it.
4. Test the working of the project.
5. Prepare the final report.

4.0Action Plan:

Sr. No Details of Planned start Planned finish Name of


Activity date date responsible
team members
1 Identify the aim of the
project topic Jidnyasa Chavan

2 Understand which tools or


Resources are used Jidnyasa Chavan

3 Prepare coding for the Jidnyasa Chavan


project and get output
after executing it

4 Prepare final report Jidnyasa Chavan

4
Advance Java Programming (22517) Hotel Management System

5.0 Resources Required:

Sr. No Name of Specification Qty Remark


Resource/material
1 Computer System JDK 1.8 1
2 Database My Sql 1

6.0 Team Members:

Sr. No Roll. No Name of Student


01 23 Jidnyasa Chavan

5
Advance Java Programming (22517) Hotel Management System

Annexure – II
Micro-Project Report
Hotel Management System

1.0 Rationale:
This project Hotel Management System is a desktop-based application that allows hotel
manager to handle all hotel activities online. Interactive GUI and the ability to manage
various rooms, employees, drivers & customers makes this system very flexible &
convenient. The purpose of the whole process is to ease the daily or regular activities of
Hotel Management into a computerized retrievable process.

2.0 Aim of the Micro – Project:


This Micro-Project aims at developing a program for ‘Hotel Management System’ using
Advance Java Programming.

3.0 Course Outcomes Addressed:


a. Develop programs using GUI framework (AWT and Swing).
b. Handle events of AWT and Swing components
c. Develop programs to handle events in Java programming.
e. Develop programs using database.

4.0 Literature Review:


Java technology is widely used for web applications. Based on the OOP concepts and
Core java core concepts it gives hands-on experience and learning on GUI technologies
viz. AWT and Swings, event handling mechanisms and network programming. JDBC
connectivity makes web and stand-alone java application more dynamic and easy to
implement. Advance Java concepts also gives coverage to various web applications
aspects like Database Interaction, server side components and servlets.

5.0 Actual Methodology Followed:


This Micro-Project aims at developing a program for ‘Hotel Management System’
using Advance Java Programming.

1. Study all the concepts of Advance Java programming.


2. Identify the requirements of project.
3. Prepare coding for the project and get output after executing it.
4. Test the working of the project.
5. Prepare the final report.

6
Advance Java Programming (22517) Hotel Management System

6.0 Resources Required:

Sr. No Name of Specification Qty Remark


Resource/material
1 Computer system JDK 1.8 1
2 Database My Sql 1

7
Advance Java Programming (22517) Hotel Management System

7.0 Source Code:

1) Splash Screen:
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class HotelManagementSystem extends JFrame implements ActionListener{
JLabel l1;
JButton b1;
public HotelManagementSystem() {
setSize(1366,430);
setLayout(null);
setLocation(300,300);
l1 = new JLabel("");
b1 = new JButton("Next");
b1.setBackground(Color.WHITE);
b1.setForeground(Color.BLACK);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/icons/first.jpg"));
Image i3 = i1.getImage().getScaledInstance(1366, 390,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
l1 = new JLabel(i2);
JLabel lid=new JLabel("HOTEL MANAGEMENT SYSTEM");
lid.setBounds(30,300,1500,100);
lid.setFont(new Font("serif",Font.PLAIN,70));
lid.setForeground(Color.red);
l1.add(lid);
b1.setBounds(1170,325,150,50);
l1.setBounds(0, 0, 1366, 390);
l1.add(b1);
add(l1);
b1.addActionListener(this);
setVisible(true);
while(true){
lid.setVisible(false); // lid = j label
try{
Thread.sleep(500); //1000 = 1 second

8
Advance Java Programming (22517) Hotel Management System

}catch(Exception e){}
lid.setVisible(true);
try{
Thread.sleep(500);
}catch(Exception e){}
}}
public void actionPerformed(ActionEvent ae){
new Login().setVisible(true);
this.setVisible(false);
}
public static void main(String[] args) {
HotelManagementSystem window = new HotelManagementSystem();
window.setVisible(true);
}}

2) Login Page:
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
public class Login extends JFrame implements ActionListener{
JLabel l1,l2;
JTextField t1;
JPasswordField t2;
JButton b1,b2;
Login(){
super("Login");
setLayout(null);
l1 = new JLabel("Username");
l1.setBounds(40,20,100,30);
add(l1);
l2 = new JLabel("Password");
l2.setBounds(40,70,100,30);
add(l2);
t1=new JTextField();
t1.setBounds(150,20,150,30);
add(t1);
t2=new JPasswordField();
t2.setBounds(150,70,150,30);
add(t2);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/second.jpg"));
Image i2 = i1.getImage().getScaledInstance(200,200,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel l3 = new JLabel(i3);

9
Advance Java Programming (22517) Hotel Management System

l3.setBounds(350,10,150,150);
add(l3);

b1 = new JButton("Login");
b1.setBounds(40,140,120,30);
b1.setFont(new Font("serif",Font.BOLD,15));
b1.addActionListener(this);
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
add(b1);

b2=new JButton("Cancel");
b2.setBounds(180,140,120,30);
b2.setFont(new Font("serif",Font.BOLD,15));
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
add(b2);
b2.addActionListener(this);

getContentPane().setBackground(Color.WHITE);
setVisible(true);
setSize(600,300);
setLocation(600,350);
}
public void actionPerformed(ActionEvent ae){
if(ae.getSource()==b1){
try{
conn c1 = new conn();
String u = t1.getText();
String v = t2.getText();
String q = "select * from login where username='"+u+"' and password='"+v+"'";
ResultSet rs = c1.s.executeQuery(q);
if(rs.next()){
new Dashboard().setVisible(true);
setVisible(false);
}else{
JOptionPane.showMessageDialog(null, "Invalid login");
setVisible(false);
}}catch(Exception e){
e.printStackTrace();
}
}else if(ae.getSource()==b2){
System.exit(0);
}}
public static void main(String[] arg);
new Login();
}
}

10
Advance Java Programming (22517) Hotel Management System

3) Dashboard:
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Dashboard extends JFrame{
public static void main(String[] args) {
new Dashboard().setVisible(true);
}
public Dashboard() {
super("HOTEL MANAGEMENT SYSTEM");
setForeground(Color.CYAN);
setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/third.jpg"));
Image i2 = i1.getImage().getScaledInstance(1950, 1000,Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel NewLabel = new JLabel(i3);
NewLabel.setBounds(0, 0, 1950, 1000);
add(NewLabel);
JLabel AirlineManagementSystem = new JLabel("THE TAJ GROUP WELCOMES
YOU");
AirlineManagementSystem.setForeground(Color.WHITE);
AirlineManagementSystem.setFont(new Font("Tahoma", Font.PLAIN, 46));
AirlineManagementSystem.setBounds(600, 60, 1000, 85);
NewLabel.add(AirlineManagementSystem);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu AirlineSystem = new JMenu("HOTEL MANAGEMENT");
AirlineSystem.setForeground(Color.BLUE);
menuBar.add(AirlineSystem);
JMenuItem FlightDetails = new JMenuItem("RECEPTION");
AirlineSystem.add(FlightDetails);
JMenu AirlineSystemHello = new JMenu("ADMIN");
AirlineSystemHello.setForeground(Color.RED);
menuBar.add(AirlineSystemHello);
JMenuItem FlightDetailshello1 = new JMenuItem("ADD EMPLOYEE");
AirlineSystemHello.add(FlightDetailshello1);
FlightDetailshello1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
new AddEmployee().setVisible(true);
}catch(Exception e ){}

11
Advance Java Programming (22517) Hotel Management System

}});
JMenuItem FlightDetailshello2 = new JMenuItem("ADD ROOMS");
AirlineSystemHello.add(FlightDetailshello2);
FlightDetailshello2.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
new AddRoom().setVisible(true);
}catch(Exception e ){}
}});
FlightDetails.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
new Reception();
}});
JMenuItem FlightDetailshello3 = new JMenuItem("ADD DRIVERS");
AirlineSystemHello.add(FlightDetailshello3);
FlightDetailshello3.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
try{
new AddDriver().setVisible(true);
}catch(Exception e ){}
}});
setSize(1950,1090);
setVisible(true);
getContentPane().setBackground(Color.WHITE);
}}

4) Add Employee:
package hotel.management.system;
import java.awt.EventQueue;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
public class AddEmployee extends JFrame{ //Third Frame
JTextField
textField,textField_1,textField_2,textField_3,textField_4,textField_5,textField_6;
JComboBox c1;
public AddEmployee(){
getContentPane().setForeground(Color.BLUE);
getContentPane().setBackground(Color.WHITE);
setTitle("ADD EMPLOYEE DETAILS");

setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
12
Advance Java Programming (22517) Hotel Management System

setSize(778,486);
getContentPane().setLayout(null);

JLabel Passportno = new JLabel("NAME");


Passportno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Passportno.setBounds(60, 30, 150, 27);
add(Passportno);

textField = new JTextField();


textField.setBounds(200, 30, 150, 27);
add(textField);

JButton Next = new JButton("SAVE");


Next.setBounds(200, 420, 150, 30);
Next.setBackground(Color.BLACK);
Next.setForeground(Color.WHITE);
add(Next);

JLabel Pnrno = new JLabel("AGE");


Pnrno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Pnrno.setBounds(60, 80, 150, 27);
add(Pnrno);

textField_1 = new JTextField();


textField_1.setBounds(200, 80, 150, 27);
add(textField_1);

JLabel Gender = new JLabel("GENDER");


Gender.setFont(new Font("Tahoma", Font.PLAIN, 17));
Gender.setBounds(60, 120, 150, 27);
add(Gender);

JRadioButton NewRadioButton = new JRadioButton("MALE");


NewRadioButton.setBackground(Color.WHITE);
NewRadioButton.setBounds(200, 120, 70, 27);
add(NewRadioButton);

JRadioButton Female = new JRadioButton("FEMALE");


Female.setBackground(Color.WHITE);
Female.setBounds(280, 120, 70, 27);
add(Female);

13
Advance Java Programming (22517) Hotel Management System

JLabel Address = new JLabel("JOB");


Address.setFont(new Font("Tahoma", Font.PLAIN, 17));
Address.setBounds(60, 170, 150, 27);
add(Address);
String course[] = {"Front Desk Clerks","Porters","Housekeeping","Kitchen
Staff","Room Service","Waiter/Waitress","Manager","Accountant","Chef"};
c1 = new JComboBox(course);
c1.setBackground(Color.WHITE);
c1.setBounds(200,170,150,30);
add(c1);

JLabel Nationality = new JLabel("SALARY");


Nationality.setFont(new Font("Tahoma", Font.PLAIN, 17));
Nationality.setBounds(60, 220, 150, 27);
add(Nationality);

textField_3 = new JTextField();


textField_3.setBounds(200, 220, 150, 27);
add(textField_3);

JLabel Name = new JLabel("PHONE");


Name.setFont(new Font("Tahoma", Font.PLAIN, 17));
Name.setBounds(60, 270, 150, 27);
add(Name);

textField_4 = new JTextField();


textField_4.setBounds(200, 270, 150, 27);
add(textField_4);

JLabel Phno = new JLabel("AADHAR");


Phno.setFont(new Font("Tahoma", Font.PLAIN, 17));
Phno.setBounds(60, 320, 150, 27);
add(Phno);

textField_5 = new JTextField();


textField_5.setBounds(200, 320, 150, 27);
add(textField_5);
JLabel email = new JLabel("EMAIL");
email.setFont(new Font("Tahoma", Font.PLAIN, 17));
email.setBounds(60, 370, 150, 27);
add(email);

14
Advance Java Programming (22517) Hotel Management System

textField_6 = new JTextField();


textField_6.setBounds(200, 370, 150, 27);
add(textField_6);
setVisible(true);
JLabel AddPassengers = new JLabel("ADD EMPLOYEE DETAILS");
AddPassengers.setForeground(Color.BLUE);
AddPassengers.setFont(new Font("Tahoma", Font.PLAIN, 31));
AddPassengers.setBounds(450, 24, 442, 35);
add(AddPassengers);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/icons/tenth.jpg"));
Image i3 = i1.getImage().getScaledInstance(500, 500,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel image = new JLabel(i2);
image.setBounds(410,80,480,410);
add(image);
Next.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent ae){
String name = textField.getText();
String age = textField_1.getText();
String salary = textField_3.getText();
String phone = textField_4.getText();
String aadhar = textField_5.getText();
String email = textField_6.getText();
String gender = null;
if(NewRadioButton.isSelected()){
gender = "male";
}else if(Female.isSelected()){
gender = "female";
}
String s6 = (String)c1.getSelectedItem();
try {
conn c = new conn();
String str = "INSERT INTO employee values( '"+name+"', '"+age+"',
'"+gender+"','"+s6+"', '"+salary+"', '"+phone+"','"+aadhar+"', '"+email+"')";
c.s.executeUpdate(str);
JOptionPane.showMessageDialog(null,"Employee Added");
setVisible(false);
} catch (Exception e) {
e.printStackTrace();
}}});

15
Advance Java Programming (22517) Hotel Management System

setSize(900,600);
setVisible(true);
setLocation(530,200);
}
public static void main(String[] args){
new AddEmployee();
}}

5) Add Room:
package hotel.management.system;
import java.awt.*;
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import java.awt.event.*;
import java.sql.*;
import java.util.*;

public class AddRoom extends JFrame implements ActionListener{


private JPanel contentPane;
private JTextField t1,t2,t3,t4;
private JComboBox comboBox, comboBox_1, comboBox_2, comboBox_3;
JButton b1,b2;
Choice c1;
public static void main(String[] args) {
new AddRoom().setVisible(true);
}
public AddRoom() {
setBounds(450, 200, 1000, 450);
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/twelve.jpg"));
Image i3 = i1.getImage().getScaledInstance(500, 300,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel l15 = new JLabel(i2);
l15.setBounds(400,30,500,370);
add(l15);

JLabel l10 = new JLabel("Add Rooms");


l10.setFont(new Font("Tahoma", Font.BOLD, 18));
l10.setBounds(194, 10, 120, 22);
contentPane.add(l10);

JLabel l1 = new JLabel("Room Number");


l1.setForeground(new Color(25, 25, 112));
l1.setFont(new Font("Tahoma", Font.BOLD, 14));
l1.setBounds(64, 70, 102, 22);
contentPane.add(l1);
t4 = new JTextField();
t4.setBounds(174, 70, 156, 20);
contentPane.add(t4);

16
Advance Java Programming (22517) Hotel Management System

JLabel l2 = new JLabel("Availability");


l2.setForeground(new Color(25, 25, 112));
l2.setFont(new Font("Tahoma", Font.BOLD, 14));
l2.setBounds(64, 110, 102, 22);
contentPane.add(l2);
comboBox = new JComboBox(new String[] { "Available", "Occupied" });
comboBox.setBounds(176, 110, 154, 20);
contentPane.add(comboBox);
JLabel l3 = new JLabel("Cleaning Status");
l3.setForeground(new Color(25, 25, 112));
l3.setFont(new Font("Tahoma", Font.BOLD, 14));
l3.setBounds(64, 150, 102, 22);
contentPane.add(l3);
comboBox_2 = new JComboBox(new String[] { "Cleaned", "Dirty" });
comboBox_2.setBounds(176, 150, 154, 20);
contentPane.add(comboBox_2);
JLabel l4 = new JLabel("Price");
l4.setForeground(new Color(25, 25, 112));
l4.setFont(new Font("Tahoma", Font.BOLD, 14));
l4.setBounds(64, 190, 102, 22);
contentPane.add(l4);
t2 = new JTextField();
t2.setBounds(174, 190, 156, 20);
contentPane.add(t2);
JLabel l5 = new JLabel("Bed Type");
l5.setForeground(new Color(25, 25, 112));
l5.setFont(new Font("Tahoma", Font.BOLD, 14));
l5.setBounds(64, 230, 102, 22);
contentPane.add(l5);
comboBox_3 = new JComboBox(new String[] { "Single Bed", "Double Bed"});
comboBox_3.setBounds(176, 230, 154, 20);
contentPane.add(comboBox_3);

b1 = new JButton("Add");
b1.addActionListener(this);
b1.setBounds(64, 321, 111, 33);
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
contentPane.add(b1);

b2 = new JButton("Back");
b2.addActionListener(this);
b2.setBounds(198, 321, 111, 33);
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
contentPane.add(b2);
contentPane.setBackground(Color.WHITE);
}
public void actionPerformed(ActionEvent ae){
try{
if(ae.getSource() == b1){
try{
conn c = new conn();
String room = t4.getText();
String available = (String)comboBox.getSelectedItem();
String status = (String)comboBox_2.getSelectedItem();
String price = t2.getText();
String type = (String)comboBox_3.getSelectedItem();

17
Advance Java Programming (22517) Hotel Management System

String str = "INSERT INTO room values( '"+room+"', '"+available+"',


'"+status+"','"+price+"', '"+type+"')";
c.s.executeUpdate(str);
JOptionPane.showMessageDialog(null, "Room Successfully Added");
this.setVisible(false);
}catch(Exception ee){
System.out.println(ee);
}}
else if(ae.getSource() == b2){
this.setVisible(false);
}
}catch(Exception eee){
}}}
6) Reception:

package hotel.management.system;
import javax.swing.*;
import java.sql.*;
import java.awt.event.*;
import java.awt.*;
public class Reception extends JFrame {
private JPanel contentPane;
public static void main(String[] args) {
new Reception();
}
public Reception(){
setBounds(530, 200, 850, 570);
contentPane = new JPanel();
setContentPane(contentPane);
contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fourth.jpg"));
Image i3 = i1.getImage().getScaledInstance(500, 500,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel l1 = new JLabel(i2);
l1.setBounds(250,30,500,470);
add(l1);

JButton btnNewCustomerForm = new JButton("New Customer Form");


btnNewCustomerForm.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
NewCustomer custom = new NewCustomer();
custom.setVisible(true);
setVisible(false);
}catch(Exception e1){
e1.printStackTrace();
}}});
btnNewCustomerForm.setBounds(10, 30, 200, 30);
btnNewCustomerForm.setBackground(Color.BLACK);
btnNewCustomerForm.setForeground(Color.WHITE);
contentPane.add(btnNewCustomerForm);

JButton btnNewButton = new JButton("Room");


btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
Room room = new Room();
room.setVisible(true);
18
Advance Java Programming (22517) Hotel Management System

setVisible(false);
}
catch(Exception e){
e.printStackTrace();
}}});
btnNewButton.setBounds(10, 70, 200, 30);
btnNewButton.setBackground(Color.BLACK);
btnNewButton.setForeground(Color.WHITE);
contentPane.add(btnNewButton);
JButton btnNewButton_1 = new JButton("Department");
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
Department dept = new Department();
dept.setVisible(true);
setVisible(false);

}
catch (Exception e1){
e1.printStackTrace();
}}});
btnNewButton_1.setBounds(10, 110, 200, 30);
btnNewButton_1.setBackground(Color.BLACK);
btnNewButton_1.setForeground(Color.WHITE);
contentPane.add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("All Employee Info");
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
Employee em = new Employee();
em.setVisible(true);
setVisible(false);
}
catch (Exception e1){
e1.printStackTrace();
}}});
btnNewButton_2.setBounds(10, 150, 200, 30);
btnNewButton_2.setBackground(Color.BLACK);
btnNewButton_2.setForeground(Color.WHITE);
contentPane.add(btnNewButton_2);

JButton btnNewButton_3 = new JButton("Customer Info");


btnNewButton_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
CustomerInfo customer = new CustomerInfo();
customer.setVisible(true);
setVisible(false);
}
catch (Exception e1){
e1.printStackTrace();
}}});
btnNewButton_3.setBounds(10, 190, 200, 30);
btnNewButton_3.setBackground(Color.BLACK);
btnNewButton_3.setForeground(Color.WHITE);
contentPane.add(btnNewButton_3);
JButton btnManagerInfo = new JButton("Manager Info");
btnManagerInfo.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{

19
Advance Java Programming (22517) Hotel Management System

ManagerInfo mana = new ManagerInfo();


mana.setVisible(true);
setVisible(false);
}
catch (Exception e1){
e1.printStackTrace();
}}});
btnManagerInfo.setBounds(10, 230, 200, 30);
btnManagerInfo.setBackground(Color.BLACK);
btnManagerInfo.setForeground(Color.WHITE);
contentPane.add(btnManagerInfo);
JButton btnNewButton_4 = new JButton("Check Out");
btnNewButton_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
CheckOut check;
try {
check = new CheckOut();
check.setVisible(true);
setVisible(false);
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnNewButton_4.setBounds(10, 270, 200, 30);
btnNewButton_4.setBackground(Color.BLACK);
btnNewButton_4.setForeground(Color.WHITE);

contentPane.add(btnNewButton_4);

JButton btnNewButton_5 = new JButton("Update Check Status");


btnNewButton_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
UpdateCheck update = new UpdateCheck();
update.setVisible(true);
setVisible(false);
}
catch(Exception e1){
e1.printStackTrace();
}}});
btnNewButton_5.setBounds(10, 310, 200, 30);
btnNewButton_5.setBackground(Color.BLACK);
btnNewButton_5.setForeground(Color.WHITE);
contentPane.add(btnNewButton_5);\
JButton btnNewButton_6 = new JButton("Update Room Status");
btnNewButton_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
UpdateRoom room = new UpdateRoom();
room.setVisible(true);
setVisible(false);
}catch(Exception s)
{
s.printStackTrace();
}}});
btnNewButton_6.setBounds(10, 350, 200, 30);
btnNewButton_6.setBackground(Color.BLACK);
btnNewButton_6.setForeground(Color.WHITE);

20
Advance Java Programming (22517) Hotel Management System

contentPane.add(btnNewButton_6);
JButton btnPickUpSerice = new JButton("Pick up Service");
btnPickUpSerice.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
PickUp pick = new PickUp();
pick.setVisible(true);
setVisible(false);
}
catch(Exception e){
e.printStackTrace();
}}});
btnPickUpSerice.setBounds(10, 390, 200, 30);
btnPickUpSerice.setBackground(Color.BLACK);
btnPickUpSerice.setForeground(Color.WHITE);

contentPane.add(btnPickUpSerice);

JButton btnSearchRoom = new JButton("Search Room");


btnSearchRoom.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
SearchRoom search = new SearchRoom();
search.setVisible(true);
setVisible(false);
}
catch (Exception ss){
ss.printStackTrace();
}}});
btnSearchRoom.setBounds(10, 430, 200, 30);
btnSearchRoom.setBackground(Color.BLACK);
btnSearchRoom.setForeground(Color.WHITE);

contentPane.add(btnSearchRoom);

JButton btnNewButton_7 = new JButton("Log Out");


btnNewButton_7.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
new Login().setVisible(true);
setVisible(false);

} catch (Exception e) {
e.printStackTrace();
}}});
btnNewButton_7.setBounds(10, 470, 200, 30);
btnNewButton_7.setBackground(Color.BLACK);
btnNewButton_7.setForeground(Color.WHITE);
contentPane.add(btnNewButton_7);
getContentPane().setBackground(Color.WHITE);

setVisible(true);
}}

21
Advance Java Programming (22517) Hotel Management System

7) All Employee Information:

package hotel.management.system;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.proteanit.sql.DbUtils;
import javax.swing.JTable;
import java.sql.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class Employee extends JFrame {
Connection conn = null;
private JPanel contentPane;
private JTable table;
private JLabel lblNewLabel;
private JLabel lblJob;
private JLabel lblName;
private JLabel lblDepartment;

public static void main(String[] args) {


EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Employee frame = new Employee();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}}});}
public void close()
{
this.dispose();
}
public Employee() throws SQLException {
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(430, 200, 1000, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

table = new JTable();


table.setBounds(0, 34, 1000, 450);
contentPane.add(table);

JButton btnLoadData = new JButton("Load Data");


btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
conn c = new conn();
String displayCustomersql = "select * from Employee";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
}

22
Advance Java Programming (22517) Hotel Management System

catch(Exception e1){
e1.printStackTrace();
}}});
btnLoadData.setBounds(350, 500, 120, 30);
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);

JButton btnExit = new JButton("Back");


btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Reception().setVisible(true);
setVisible(false);
}});
btnExit.setBounds(510, 500, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
lblNewLabel = new JLabel("Name");
lblNewLabel.setBounds(41, 11, 46, 14);
contentPane.add(lblNewLabel);
lblJob = new JLabel("Age");
lblJob.setBounds(159, 11, 46, 14);
contentPane.add(lblJob);
lblName = new JLabel("Gender");
lblName.setBounds(273, 11, 46, 14);
contentPane.add(lblName);
lblDepartment = new JLabel("Job");
lblDepartment.setBounds(416, 11, 86, 14);
contentPane.add(lblDepartment);
JLabel l1 = new JLabel("Salary");
l1.setBounds(536, 11, 86, 14);
contentPane.add(l1);
JLabel l2 = new JLabel("Phone");
l2.setBounds(656, 11, 86, 14);
contentPane.add(l2);
JLabel l3 = new JLabel("Aadhar");
l3.setBounds(786, 11, 86, 14);
contentPane.add(l3);
JLabel l4 = new JLabel("Gmail");
l4.setBounds(896, 11, 86, 14);
contentPane.add(l4);
getContentPane().setBackground(Color.WHITE);
}}

8) All Customer Information:

package hotel.management.system;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.proteanit.sql.DbUtils;
import java.sql.*;
import javax.swing.*;
import javax.swing.JTable;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

23
Advance Java Programming (22517) Hotel Management System

public class CustomerInfo extends JFrame {


Connection conn = null;
private JPanel contentPane;
private JLabel lblId;
private JLabel lblNewLabel;
private JLabel lblGender;
private JTable table;
private JLabel lblCountry;
private JLabel lblRoom;
private JLabel lblStatus;
private JLabel lblNewLabel_1;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
CustomerInfo frame = new CustomerInfo();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}});}
public void close(){
this.dispose();
}
public CustomerInfo() throws SQLException {
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(530, 200, 900, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JButton btnExit = new JButton("Back");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Reception().setVisible(true);
setVisible(false);
}});
btnExit.setBounds(450, 510, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
JButton btnLoadData = new JButton("Load Data");
btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
conn c = new conn();
String displayCustomersql = "select * from Customer";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
}catch(Exception e){
e.printStackTrace();
}}});
btnLoadData.setBounds(300, 510, 120, 30);
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
lblId = new JLabel("ID");
lblId.setBounds(31, 11, 46, 14);
contentPane.add(lblId);
JLabel l1 = new JLabel("Number");

24
Advance Java Programming (22517) Hotel Management System

l1.setBounds(150, 11, 46, 14);


contentPane.add(l1);
lblNewLabel = new JLabel("Name");
lblNewLabel.setBounds(270, 11, 65, 14);
contentPane.add(lblNewLabel);
lblGender = new JLabel("Gender");
lblGender.setBounds(360, 11, 46, 14);
contentPane.add(lblGender);
table = new JTable();
table.setBounds(0, 40, 900, 450);
contentPane.add(table);
lblCountry = new JLabel("Country");
lblCountry.setBounds(480, 11, 46, 14);
contentPane.add(lblCountry);
lblRoom = new JLabel("Room");
lblRoom.setBounds(600, 11, 46, 14);
contentPane.add(lblRoom);
lblStatus = new JLabel("Check-in Status");
lblStatus.setBounds(680, 11, 100, 14);
contentPane.add(lblStatus);
lblNewLabel_1 = new JLabel("Deposit");
lblNewLabel_1.setBounds(800, 11, 100, 14);
contentPane.add(lblNewLabel_1);
getContentPane().setBackground(Color.WHITE);
}}

9) Manager Information:

package hotel.management.system;
import java.awt.BorderLayout;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.proteanit.sql.DbUtils;
import javax.swing.JTable;
import java.sql.*;
import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class ManagerInfo extends JFrame {
Connection conn = null;
private JPanel contentPane;
private JTable table;
private JLabel lblNewLabel;
private JLabel lblJob;
private JLabel lblName;
private JLabel lblDepartment;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
ManagerInfo frame = new ManagerInfo();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}}});}
public void close(){
this.dispose();}

25
Advance Java Programming (22517) Hotel Management System

public ManagerInfo() throws SQLException {


//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(430, 200, 1000, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
table = new JTable();
table.setBounds(0, 34, 1000, 450);
contentPane.add(table);
JButton btnLoadData = new JButton("Load Data");
btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{ conn c = new conn();
String displayCustomersql = "select * from Employee where job = 'Manager'";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));}
catch(Exception e1){
e1.printStackTrace();
}}});
btnLoadData.setBounds(350, 500, 120, 30);
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
JButton btnExit = new JButton("Back");
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
new Reception().setVisible(true);
setVisible(false); }});
btnExit.setBounds(510, 500, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
lblNewLabel = new JLabel("Name");
lblNewLabel.setBounds(41, 11, 46, 14);
contentPane.add(lblNewLabel);
lblJob = new JLabel("Age");
lblJob.setBounds(159, 11, 46, 14);
contentPane.add(lblJob);
lblName = new JLabel("Gender");
lblName.setBounds(273, 11, 46, 14);
contentPane.add(lblName);
lblDepartment = new JLabel("Job");
lblDepartment.setBounds(416, 11, 86, 14);
contentPane.add(lblDepartment);
JLabel l1 = new JLabel("Salary");
l1.setBounds(536, 11, 86, 14);
contentPane.add(l1);
JLabel l2 = new JLabel("Phone");
l2.setBounds(656, 11, 86, 14);
contentPane.add(l2);
JLabel l3 = new JLabel("Aadhar");
l3.setBounds(786, 11, 86, 14);
contentPane.add(l3);
JLabel l4 = new JLabel("Gmail");
l4.setBounds(896, 11, 86, 14);
contentPane.add(l4);
getContentPane().setBackground(Color.WHITE);
}}

26
Advance Java Programming (22517) Hotel Management System

Sql Query:

create database hotelmanagementsystem;


show databases;
use hotelmanagementsystem;
create table login(username varchar(25), password varchar(25));
insert into login values('admin', '12345');
select * from login;
create table employee(name varchar(25), age varchar(10), gender varchar(15), job varchar(30), salary
varchar(15),
phone varchar(15), email varchar(40), aadhar varchar(20));
describe employee;
select * from employee;
create table room(roomnumber varchar(10), availability varchar(20), cleaning_status varchar(20),
price varchar(20),
bed_type varchar(20));
select * from room;
update room set availability = 'Available' where roomnumber = '101';
create table driver(name varchar(20), age varchar(10), gender varchar(15), company varchar(20),
branch varchar(20),
available varchar(20), location varchar(40));
select * from driver;
ALTER TABLE driver RENAME COLUMN branch TO brand;
create table customer(document varchar(20), number varchar(30), name varchar(30), gender
varchar(15),
country varchar(20), room varchar(10), checkintime varchar(80), deposit varchar(20));
select * from customer;
create table department(department varchar(30), budget varchar(30));
insert into department values('Front Office','500000');
insert into department values('Housekeeping', '40000');
insert into department values('Food and Beverage', '23000');
insert into department values('Kitchen or Food Production', '540000');
insert into department values('Security', '320000');
select * from department;

27
Advance Java Programming (22517) Hotel Management System

8.0 Output:
1) Splash Screen:

2) Login Page:

3) Dashboard:

28
Advance Java Programming (22517) Hotel Management System

4) Add Employee:

5) Add Rooms:

29
Advance Java Programming (22517) Hotel Management System

6) Reception:

7) Customer Form:

30
Advance Java Programming (22517) Hotel Management System

8) Room Details:

9) Employee Details:

31
Advance Java Programming (22517) Hotel Management System

10) Check-In details:

11) Check-Out details:

32
Advance Java Programming (22517) Hotel Management System

10.0 Skills Developed:


 During developing the Micro-Project, we learnt many practically applied
concepts of Advance Java Programming language and theory as well.
 We learned to build code using various AWT and Swing components.
 We learned to connect Database through My Sql

9.0 Applications of this Project:


This project prepared using Advance Java Programing functions, finds its
applications andsignificance in various situations like:
a. Mobile Applications
b. Desktop GUI Applications
c. Management System Applications
d. Network Applications
e. Games and Android Applications.

10.0 Conclusion:

Thus, we designed and build a code for Hotel Management System using various Advance
Java Programming controls and components with implementation of JDBC connectivity.

11.0 Reference:
 www.tutorialspoint.com
 www.studytonight.com
 www.geeksforgeeks.com

33

You might also like