بِسْمِ ٱللَّهِ — Journey with peace (Naaz Hajj Umrah Travels)
General Documents
Hajj Specific
Umrah Specific
Women Pilgrims
Senior Citizens
Java Lab Manual

Advanced Java Programming Lab

Part B: JSP Programs

1. JSP Order Form

<form method="post">
Item: <input name="item"><br> 
Price: <input name="price"><br> 
Quantity: <input name="qty"><br>
<input type="submit" value="Calculate">
</form>
<%
if(request.getParameter("item") != null){
    double price = Double.parseDouble(request.getParameter("price")); 
    int qty = Integer.parseInt(request.getParameter("qty"));
    double total = price * qty;
%>
<b>Total Price: <%= total %></b>
<% } %>
Expected Output:
Input: Item = Pen, Price = 200, Qty = 3
Total Price: 600.0

2. JSP Login System

<form method="post">
Username: <input name="user"><br>
<input type="submit" value="Login">
</form>

<%
if(request.getParameter("user") != null){ 
    session.setAttribute("user", request.getParameter("user")); 
    out.print("Welcome " + session.getAttribute("user"));
}
%>
Expected Output:
(Displays "Welcome [Username]" after submission)

3. Currency Converter (INR to USD)

<form method="post">
Amount: <input name="amt"><br> 
Convert to <select name="cur">
    <option>USD</option><option>INR</option>
</select>
<input type="submit" value="Convert">
</form>

<%
if(request.getParameter("amt") != null){
    double amt = Double.parseDouble(request.getParameter("amt")); 
    String cur = request.getParameter("cur");
    // 1 USD = 83 INR (Example rate)
    double res = cur.equals("USD") ? amt * 0.012 : amt * 83.0;
    out.print("Converted Amount: " + res);
}
%>
Expected Output:
Input: 100 INR to USD
Converted Amount: 1.2

Java AWT & Swing Programs

4. Mouse Events (Adapter Class)

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class MouseEventAdapterDemo extends JFrame {
    JLabel label;

    public MouseEventAdapterDemo() {
        label = new JLabel("Move or click the mouse");
        label.setBounds(50, 50, 200, 30);
        add(label);

        setSize(300, 200);
        setLayout(null);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                label.setText("Mouse Pressed at (" + e.getX() + ", " + e.getY() + ")");
            }
            public void mouseReleased(MouseEvent e) {
                label.setText("Mouse Released at (" + e.getX() + ", " + e.getY() + ")");
            }
        });

        addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseMoved(MouseEvent e) {
                label.setText("Mouse Moved at (" + e.getX() + ", " + e.getY() + ")");
            }
        });
    }
    public static void main(String[] args) {
        new MouseEventAdapterDemo();
    }
}

5. Keyboard Events

import java.awt.*;
import java.awt.event.*;

public class KeyboardEventDemo extends Frame {
    Label label;

    public KeyboardEventDemo() {
        label = new Label("Press any key...");
        label.setBounds(50, 80, 200, 30);
        add(label);

        setSize(300, 200);
        setLayout(null);
        setVisible(true);

        addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                label.setText("Key Pressed: " + e.getKeyChar());
            }
            public void keyReleased(KeyEvent e) {
                label.setText("Key Released: " + e.getKeyChar());
            }
            public void keyTyped(KeyEvent e) {
                label.setText("Key Typed: " + e.getKeyChar());
            }
        });

        // Close window on click
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                dispose();
            }
        });
    }

    public static void main(String[] args) {
        new KeyboardEventDemo();
    }
}

6. Basic Calculator

import java.awt.*;
import java.awt.event.*;

public class BasicCalculator extends Frame implements ActionListener {
    TextField tf;
    double num1 = 0, num2 = 0, result = 0;
    char operator;

    public BasicCalculator() {
        setLayout(new BorderLayout());
        tf = new TextField();
        add(tf, BorderLayout.NORTH);

        Panel panel = new Panel();
        panel.setLayout(new GridLayout(4, 4, 5, 5));
        String[] buttons = {"7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", "C", "=", "+"};

        for (String b : buttons) {
            Button btn = new Button(b);
            btn.addActionListener(this);
            panel.add(btn);
        }
        add(panel, BorderLayout.CENTER);
        setTitle("Calculator");
        setSize(300, 300);
        setVisible(true);

        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) { dispose(); }
        });
    }

    public void actionPerformed(ActionEvent e) {
        String input = e.getActionCommand();
        if (input.charAt(0) >= '0' && input.charAt(0) <= '9') {
            tf.setText(tf.getText() + input);
        } else if (input.equals("C")) {
            tf.setText("");
            num1 = num2 = result = 0;
        } else if (input.equals("=")) {
            num2 = Double.parseDouble(tf.getText());
            switch (operator) {
                case '+': result = num1 + num2; break;
                case '-': result = num1 - num2; break;
                case '*': result = num1 * num2; break;
                case '/': result = num2 != 0 ? num1 / num2 : 0; break;
            }
            tf.setText(String.valueOf(result));
        } else {
            num1 = Double.parseDouble(tf.getText());
            operator = input.charAt(0);
            tf.setText("");
        }
    }
    public static void main(String[] args) { new BasicCalculator(); }
}

7. Ice Cream Menu (Checkbox)

import java.awt.*;
import java.awt.event.*;

public class IceCreamMenu extends Frame implements ItemListener {
    Label label;
    Checkbox vanilla, chocolate, strawberry, mango;
    CheckboxGroup flavors;

    public IceCreamMenu() {
        setTitle("Ice Cream Menu");
        setLayout(new FlowLayout());
        label = new Label("Select your favorite flavor:");
        add(label);
        flavors = new CheckboxGroup();
        vanilla = new Checkbox("Vanilla", flavors, false);
        chocolate = new Checkbox("Chocolate", flavors, false);
        strawberry = new Checkbox("Strawberry", flavors, false);
        mango = new Checkbox("Mango", flavors, false);
        add(vanilla); add(chocolate); add(strawberry); add(mango);
        
        vanilla.addItemListener(this);
        chocolate.addItemListener(this);
        strawberry.addItemListener(this);
        mango.addItemListener(this);

        setSize(300, 200);
        setVisible(true);
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) { dispose(); }
        });
    }
    public void itemStateChanged(ItemEvent e) {
        Checkbox selected = flavors.getSelectedCheckbox();
        label.setText("You selected: " + selected.getLabel());
    }
    public static void main(String[] args) { new IceCreamMenu(); }
}

8. Gender Selection (Radio Button)

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class SimpleRadioButton extends JFrame implements ActionListener {
    JRadioButton male, female;
    ButtonGroup genderGroup;
    JLabel resultLabel;

    public SimpleRadioButton() {
        setTitle("Gender Selection");
        setSize(250, 150);
        setLayout(new FlowLayout());
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        male = new JRadioButton("Male");
        female = new JRadioButton("Female");
        genderGroup = new ButtonGroup();
        genderGroup.add(male);
        genderGroup.add(female);

        male.addActionListener(this);
        female.addActionListener(this);

        resultLabel = new JLabel("Select your gender");
        add(male); add(female); add(resultLabel);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        if (male.isSelected()) {
            resultLabel.setText("You selected: Male");
        } else if (female.isSelected()) {
            resultLabel.setText("You selected: Female");
        }
    }
    public static void main(String[] args) { new SimpleRadioButton(); }
}

9. Hobby Selector (Checkbox)

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class CheckBoxDemo extends JFrame implements ActionListener {
    JCheckBox music, sports, reading;
    JLabel label;

    public CheckBoxDemo() {
        setTitle("Hobby Selector");
        setSize(300, 200);
        setLayout(new FlowLayout());
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        music = new JCheckBox("Music");
        sports = new JCheckBox("Sports");
        reading = new JCheckBox("Reading");

        music.addActionListener(this);
        sports.addActionListener(this);
        reading.addActionListener(this);

        label = new JLabel("Select your hobbies");
        add(music); add(sports); add(reading); add(label);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        String selected = "You selected: ";
        if (music.isSelected()) selected += "Music ";
        if (sports.isSelected()) selected += "Sports ";
        if (reading.isSelected()) selected += "Reading ";
        label.setText(selected.trim());
    }
    public static void main(String[] args) { new CheckBoxDemo(); }
}

General Documents Required

These documents are required for all pilgrims traveling for Hajj or Umrah:

Valid Passport

Passport with at least 6 months validity from the date of travel. Must have at least 2 blank pages for visa stamping.

Note: Passport should be in good condition without any damage.

Download Checklist

Passport Size Photographs

Recent passport size photographs with white background. Women should wear hijab in photos.

Note: Photos should not be older than 6 months.

Photo Guidelines

Medical Certificate

Certificate from a registered medical practitioner confirming fitness for travel.

Note: Must include vaccination records for meningitis and COVID-19.

Download Form

National ID Proof

Aadhaar card, Voter ID, or any other government-issued identity proof.

Note: Self-attested copy required.

ID Guidelines

Travel Insurance

Comprehensive travel insurance covering medical emergencies, trip cancellation, and lost baggage.

Note: Must be valid for the entire duration of your stay.

Insurance Requirements

Flight Tickets

Confirmed return flight tickets with all details clearly visible.

Note: Keep both digital and physical copies.

Ticket Guidelines

Hajj Specific Documents

Additional documents required specifically for Hajj pilgrimage:

Hajj Application Form

Duly filled Hajj application form with all details and recent photograph.

Note: Form must be signed by the applicant.

Download Form

Meningitis Vaccination Certificate

Certificate proving vaccination against meningococcal meningitis.

Note: Must be administered at least 10 days before travel.

Vaccination Details

Hajj Fee Receipt

Receipt of payment for Hajj fees and other associated charges.

Note: Keep both original and photocopy.

Fee Details

Group Documentation

Group registration documents if traveling with a group.

Note: Must include group leader details and group member list.

Group Guidelines

Umrah Specific Documents

Documents required specifically for Umrah pilgrimage:

Umrah Visa Application

Duly filled Umrah visa application form with all details.

Note: Form must be signed by the applicant.

Download Form

Hotel Booking Confirmation

Confirmed hotel booking details in Makkah and Madinah.

Note: Must include booking reference and dates.

Booking Guidelines

Travel Itinerary

Detailed travel itinerary including flight details and accommodation.

Note: Should include all dates and locations.

Itinerary Template

Documents for Women Pilgrims

Additional documents required for women pilgrims:

Mahram Information

Details of Mahram (male guardian) accompanying the woman pilgrim.

Note: Required for women under 45 years of age.

Mahram Form

No Objection Certificate

NOC from husband/father for women traveling without Mahram (if applicable).

Note: Required for women over 45 traveling alone or in groups.

NOC Template

Marriage Certificate

Marriage certificate for married women.

Note: Self-attested copy required.

Guidelines

Documents for Senior Citizens

Additional documents required for senior citizen pilgrims:

Detailed Medical Report

Comprehensive medical report from a registered medical practitioner.

Note: Should include all existing medical conditions and medications.

Medical Form

Medication Prescription

Valid prescription for all medications being carried during the journey.

Note: Should include generic names of all medicines.

Prescription Guidelines

Fitness Certificate

Certificate confirming fitness to perform Hajj/Umrah rituals.

Note: Should be issued by a registered medical practitioner.

Fitness Form

Frequently Asked Questions

How long before the journey should I start preparing my documents?
We recommend starting your document preparation at least 3-4 months before your planned journey. This gives you ample time to gather all necessary documents, complete any medical requirements, and handle any unexpected delays in the process.
Do I need to carry original documents or photocopies?
You should carry original documents for verification at immigration and other checkpoints. However, it's wise to keep both original and photocopies of all important documents. Keep the photocopies separately from the originals in case of loss or theft.
What if my passport is expiring soon?
Your passport must have at least 6 months validity from the date of travel. If your passport is expiring sooner, you should renew it before applying for Hajj/Umrah visa. The renewal process can take several weeks, so plan accordingly.
Is travel insurance mandatory for Hajj/Umrah?
Yes, comprehensive travel insurance is mandatory for Hajj and Umrah. It should cover medical emergencies, trip cancellation, lost baggage, and other travel-related issues. We can assist you in getting appropriate insurance coverage.
What vaccinations are required for Hajj/Umrah?
Meningococcal meningitis vaccination is mandatory for all pilgrims. Additionally, COVID-19 vaccination may be required depending on current regulations. Seasonal flu vaccination is also recommended. All vaccinations should be administered at least 10 days before travel.