final String userName = “Student”;
        final String password = “12345”;
        boolean authenticated = false;
        int attempts = 0;

        // Login system
        while (!authenticated && attempts < 3) {
            String inputUserName = JOptionPane.showInputDialog(null, “Enter your username:”);
            if (inputUserName == null || inputUserName.equalsIgnoreCase(“exit”)) {
                JOptionPane.showMessageDialog(null, “Login canceled. Exiting program.”);
                System.exit(0);
            }

            String inputPassword = JOptionPane.showInputDialog(null, “Enter your password:”);
            if (inputPassword == null || inputPassword.equalsIgnoreCase(“exit”)) {
                JOptionPane.showMessageDialog(null, “Login canceled. Exiting program.”);
                System.exit(0);
            }

            if (inputUserName.equals(userName) && inputPassword.equals(password)) {
                authenticated = true;
                JOptionPane.showMessageDialog(null, “Login successful!”);
            } else {
                attempts++;
                if (attempts < 3) {
                    JOptionPane.showMessageDialog(null, “Incorrect username or password. Please try again.”);
                } else {
                    JOptionPane.showMessageDialog(null, “Too many failed attempts. Please try again later.”);
                    System.exit(0);
                }
            }
        }

        JOptionPane.showMessageDialog(null, “Welcome to the Movie Ticket Booking System!”);

        // Collect user details
        String fullName = “”;
        String ageStr = “”;
        int age = 0;
        String email = “”;

        // Full Name
        while (true) {
            fullName = JOptionPane.showInputDialog(null, “Enter your full name:”);
            if (fullName == null || fullName.equalsIgnoreCase(“exit”)) {
                JOptionPane.showMessageDialog(null, “Exiting program.”);
                System.exit(0);
            } else if (fullName.trim().isEmpty() || !fullName.matches(“[a-zA-Z ]+”)) {
                JOptionPane.showMessageDialog(null, “Invalid name. Please use letters and spaces only.”);
            } else {
                break;
            }
        }

        // Age
        while (true) {
            ageStr = JOptionPane.showInputDialog(null, “Enter your age:”);
            if (ageStr == null || ageStr.equalsIgnoreCase(“exit”)) {
                JOptionPane.showMessageDialog(null, “Exiting program.”);
                System.exit(0);
            }

            try {
                age = Integer.parseInt(ageStr);
                if (age < 12) {
                    JOptionPane.showMessageDialog(null, “Sorry, you must be at least 12 years old to book a ticket.”);
                } else {
                    break;
                }
            } catch (NumberFormatException e) {
                JOptionPane.showMessageDialog(null, “Invalid input. Please enter a valid age.”);
            }
        }

        // Email
        while (true) {
            email = JOptionPane.showInputDialog(null, “Enter your email address:”);
            if (email == null || email.equalsIgnoreCase(“exit”)) {
                JOptionPane.showMessageDialog(null, “Exiting program.”);
                System.exit(0);
            } else if (email.trim().isEmpty() || !email.matches(“^[\\w.-]+@[\\w.-]+\\.\\w+$”)) {
                JOptionPane.showMessageDialog(null, “Invalid email format. Try again.”);
            } else {
                break;
            }
        }

        // Movie selection and booking loop
        boolean running = true;

        while (running) {
            Object[] movies = {
                “Avengers: Endgame”,
                “Interstellar”,
                “Inception”,
                “Barbie”,
                “Exit”
            };

            int selectedMovie = JOptionPane.showOptionDialog(
                    null,
                    “Select a movie to book tickets:”,
                    “Movie Selection”,
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    movies,
                    movies[0]
            );

            if (selectedMovie == JOptionPane.CLOSED_OPTION || movies[selectedMovie].equals(Exit”)) {
                running = false;
                JOptionPane.showMessageDialog(null, “Thank you for using the Movie Ticket Booking System!\nGoodbye, ” + fullName + “!”);
                break;
            }

            String ticketCountStr;
            int ticketCount = 0;
            while (true) {
                ticketCountStr = JOptionPane.showInputDialog(null, “Enter number of tickets for ” + movies[selectedMovie] + “:”);
                if (ticketCountStr == null || ticketCountStr.equalsIgnoreCase(“exit”)) {
                    JOptionPane.showMessageDialog(null, “Canceled. Returning to movie selection.”);
                    break;
                }

                try {
                    ticketCount = Integer.parseInt(ticketCountStr);
                    if (ticketCount <= 0) {
                        JOptionPane.showMessageDialog(null, “Please enter a number greater than 0.”);
                    } else {
                        break;
                    }
                } catch (NumberFormatException e) {
                    JOptionPane.showMessageDialog(null, “Invalid input. Please enter a valid number.”);
                }
            }

            if (ticketCount <= 0) continue;

            int response = JOptionPane.showConfirmDialog(
                    null,
                    “You’re booking ” + ticketCount + ” ticket(s) for:\n” + movies[selectedMovie] +
                            “\n\nDo you want to confirm?”,
                    “Confirm Booking”,
                    JOptionPane.YES_NO_OPTION
            );

            if (response == JOptionPane.YES_OPTION) {
                final int pricePerTicket = 250;
                int totalAmount = ticketCount * pricePerTicket;

                String paymentStr = JOptionPane.showInputDialog(
                        null,
                        “Total amount: PHP ” + totalAmount + “\nEnter payment amount:”
                );

                if (paymentStr == null || paymentStr.equalsIgnoreCase(“exit”)) {
                    JOptionPane.showMessageDialog(null, “Payment canceled. Returning to movie selection.”);
                    continue;
                }

                try {
                    double payment = Double.parseDouble(paymentStr);
                    double difference = payment – totalAmount;
                    String paymentMessage;

                    if (difference > 0) {
                        paymentMessage = “Change: PHP ” + String.format(“%.2f”, difference);
                    } else if (difference < 0) {
                        paymentMessage = “Insufficient payment. You’re short by: PHP “ + String.format(“%.2f”, -difference);
                        JOptionPane.showMessageDialog(null, paymentMessage + “\nBooking canceled.”);
                        continue;
                    } else {
                        paymentMessage = “Exact amount received.”;
                    }

                    JOptionPane.showMessageDialog(
                            null,
                            “Booking Confirmed!\n\n” +
                                    “Customer: ” + fullName + “\n” +
                                    “Age: ” + age + “\n” +
                                    “Email: “ + email + “\n” +
                                    “Movie: ” + movies[selectedMovie] + “\n” +
                                    “Tickets: ” + ticketCount + “\n” +
                                    “Price per ticket: PHP ” + pricePerTicket + “\n” +
                                    “Total: PHP ” + totalAmount + “\n” +
                                    “Payment: PHP ” + String.format(“%.2f”, payment) + “\n” +
                                    paymentMessage + “\n\nThank you for booking!”
                    );

                } catch (NumberFormatException e) {
                    JOptionPane.showMessageDialog(null, “Invalid payment input. Booking canceled.”);
                }
            } else {
                JOptionPane.showMessageDialog(null, “Booking canceled.”);
            }
        }
    }
}

 
 

LIBRARY CODE

    String namePattern = “^[A-Za-z\\s]{2,50}$”;
    String bookPattern = “^[\\w\\s\\p{Punct}]{1,100}$”;

        while (true) {

            int startChoice = JOptionPane.showConfirmDialog(null, ” Do you want to make a book reservation?”, “Library System”, JOptionPane.YES_NO_OPTION);
            if (startChoice != JOptionPane.YES_OPTION) {
            int exitConfirm = JOptionPane.showConfirmDialog(null, “Are you sure you want to exit?”, “Confirm Exit”, JOptionPane.YES_NO_OPTION);
            if (exitConfirm == JOptionPane.YES_OPTION) {
                    JOptionPane.showMessageDialog(null,  Thank you for using the Library System!”);
                    System.exit(0);
                } else {
                    continue;
                }
            }

            String name = “”;
            String bookTitle = “”;

            while (true) {
                name = JOptionPane.showInputDialog(Enter your full name:”);
                if (name == null) {
                    int cancelConfirm = JOptionPane.showConfirmDialog(null, “Cancel reservation and exit?”, “Cancel”, JOptionPane.YES_NO_OPTION);
                    if (cancelConfirm == JOptionPane.YES_OPTION) {
                        JOptionPane.showMessageDialog(null, “Reservation cancelled. Exiting…”);
                        System.exit(0);
                    } else {
                        continue;
                    }
                }
                if (Pattern.matches(namePattern, name.trim())) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, ” Invalid name. Only letters and spaces allowed.”);
                }
            }

            while (true) {
                bookTitle = JOptionPane.showInputDialog(Enter the book title:”);
                if (bookTitle == null) {
                    int cancelConfirm = JOptionPane.showConfirmDialog(null, “Cancel reservation and exit?”, “Cancel”, JOptionPane.YES_NO_OPTION);
                    if (cancelConfirm == JOptionPane.YES_OPTION) {
                        JOptionPane.showMessageDialog(null, “Reservation cancelled. Exiting…”);
                        System.exit(0);
                    } else {
                        continue;
                    }
                }
                if (Pattern.matches(bookPattern, bookTitle.trim())) {
                    break;
                } else {
                    JOptionPane.showMessageDialog(null, ” Invalid book title.”);
                }
            }

            String message = ” Reservation Complete!\n\nName: ” + name + “\nBook: ” + bookTitle;
            JOptionPane.showMessageDialog(null, message);

            int again = JOptionPane.showConfirmDialog(null, “Do you want to reserve another book?”, “Continue?”, JOptionPane.YES_NO_OPTION);
            if (again != JOptionPane.YES_OPTION) {
                JOptionPane.showMessageDialog(null, ” Thank you for using the Library System!”);
                break;
            }
        }

        System.exit(0);
    }
}

ENGINEERING TOOLS ORDER

        String customerName = “”;
        String contactNumber = “”;
        String contactAddress = “”;

        int total = 0;  // To keep track of total amount

        // Get name
        while (true) {
            customerName = JOptionPane.showInputDialog(“Enter your name:”);
            if (customerName == null || customerName.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Name is required.”);
            } else if (!customerName.matches(“[a-zA-Z ]+”)) {
                JOptionPane.showMessageDialog(null, “Invalid name. Please enter letters only.”);
            } else {
                break;
            }
        }

        // Get contact number
        while (true) {
            contactNumber = JOptionPane.showInputDialog(“Enter your contact number:”);
            if (contactNumber == null || contactNumber.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Contact number is required.”);
            } else if (!contactNumber.matches(“\\d+”)) {
                JOptionPane.showMessageDialog(null, “Invalid contact number. Use numbers only.”);
            } else {
                break;
            }
        }

        // Get address
        while (true) {
            contactAddress = JOptionPane.showInputDialog(“Enter your delivery address:”);
            if (contactAddress == null || contactAddress.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Address is required.”);
            } else {
                int confirm = JOptionPane.showConfirmDialog(null,
                        “You entered:\n” + contactAddress + “\n\nIs this correct?”,
                        “Confirm Address”,
                        JOptionPane.YES_NO_OPTION);
                if (confirm == JOptionPane.YES_OPTION) {
                    break;
                }
            }
        }

        // Start ordering
        boolean ordering = true;
        while (ordering) {
            String[] items = {“T-Square”, “ScientificCal”, “MechanicalCal”, “Compass”, “Protractor”, “Exit”};
            int choice = JOptionPane.showOptionDialog(null,
                    “Select an item to order:”,
                    “Items”,
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    items,
                    items[0]);

            if (choice == -1 || items[choice].equals(“Exit”)) {
                ordering = false;
                break;
            }

            String item = items[choice];

            String quantityInput = JOptionPane.showInputDialog(“Enter quantity for ” + item + “:”);
            if (quantityInput != null) {
                int quantity = 0;
                boolean valid = true;

                try {
                    quantity = Integer.parseInt(quantityInput);
                    if (quantity <= 0) {
                        valid = false;
                        JOptionPane.showMessageDialog(null, “Quantity must be greater than 0.”);
                    }
                } catch (Exception e) {
                    valid = false;
                    JOptionPane.showMessageDialog(null, “Please enter a valid number.”);
                }

                if (valid) {
                    int price = 0;

                    if (item.equals(“T-Square”)) {
                        price = 2000;
                    } else if (item.equals(“ScientificCal”)) {
                        price = 1800;
                    } else if (item.equals(“MechanicalCal”)) {
                        price = 4000;
                    } else if (item.equals(“Compass”)) {
                        price = 1000;
                    } else if (item.equals(“Protractor”)) {
                        price = 25;
                    }

                    int subtotal = quantity * price;
                    total += subtotal;

                    JOptionPane.showMessageDialog(null, item + ” x ” + quantity + ” = ₱” + subtotal);

                    String[] payments = {“Cash”, “Gcash”, “PayMaya”, “Credit Card”};
                    String paymentMethod = (String) JOptionPane.showInputDialog(null,
                            “Choose payment method:”,
                            “Payment”,
                            JOptionPane.PLAIN_MESSAGE,
                            null,
                            payments,
                            payments[0]);

                    if (paymentMethod != null) {
                        JOptionPane.showMessageDialog(null,
                                “Order confirmed!\n” +
                                item + ” x ” + quantity + “\n” +
                                “Payment: ” + paymentMethod);
                    } else {
                        JOptionPane.showMessageDialog(null, “Order canceled. No payment selected.”);
                    }
                }
            } else {
                JOptionPane.showMessageDialog(null, “You canceled the quantity input.”);
            }
        }

       JOptionPane.showMessageDialog(null, “Welcome to Engineering Tools Ordering System”);
       
        String customerName= “”;
        String contactNumber = “”;
        String contactAddress = “”;
       
        while (true) {
            customerName = JOptionPane.showInputDialog(null, “Enter your name:”);

            if (customerName == null || customerName.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Name is required.”);
            } else if (!customerName.matches(“[a-zA-Z ]+”)) {
                JOptionPane.showMessageDialog(null, “Invalid name. Please enter letters only.”);
            } else {
                break;
            }
        }

   
        while (true) {
            contactNumber = JOptionPane.showInputDialog(null, “Enter your contact number:”);

            if (contactNumber == null || contactNumber.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Contact number is required.”);
            } else if (!contactNumber.matches(“\\d+”)) {
                JOptionPane.showMessageDialog(null, “Invalid contact number. Please enter numbers only.”);
            } else {
                break;
            }
        }

       
        while (true) {
            contactAddress = JOptionPane.showInputDialog(null, “Enter your delivery address:”);

            if (contactAddress == null || contactAddress.trim().isEmpty()) {
                JOptionPane.showMessageDialog(null, “Address is required.”);
            } else {
                int confirmAddress = JOptionPane.showConfirmDialog(
                        null,
                        “You entered:\n” + contactAddress + “\n\nAre you sure you want to send the order to this address?”,
                        “Confirm Address”,
                        JOptionPane.YES_NO_OPTION
                );

                if (confirmAddress == JOptionPane.YES_OPTION) {
                    break;
                }
             
            }
        }
                 boolean running = true;
                 while (running) {
                         
                Object[] products = {“T-Square”, “ScientificCal”, “MechanicalCal”, “Compass”, “Protractor”, “Exit”};
                int selectedProduct = JOptionPane.showOptionDialog(
                    null,
                    “Please choose an item to order:”,
                    “Item Selection”,
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    products,
                    products[0]
            );
           
                if (selectedProduct ==JOptionPane.CLOSED_OPTION || products[selectedProduct].equals(“Exit”)){
                    running = false;
                    JOptionPane.showMessageDialog(null, “Thank you for using the Engineering Ordering System.”);
                }else{
                    String quantityString = JOptionPane.showInputDialog(null, “Enter the quantity for ” + products[selectedProduct] + “:”);
                   
                    if (quantityString !=null){
                        int quantity =0;
                        boolean validInput = true;
                       
                        try{
                            quantity = Integer.parseInt(quantityString);
                           if(quantity <=0){
                               validInput =false;
                     
                        JOptionPane.showMessageDialog(null, “Pls enter a quantity greater than 0.”);
                    }
                        }catch(NumberFormatException e){
                            validInput=  false;
                            JOptionPane.showMessageDialog(null, “Invalid Input.Pls enter a valid number for quantity”);
                        }
                       
                      if (validInput){
                          int response= JOptionPane.showConfirmDialog(
                      null,
                      “You ordered”  + quantity + ” ” + products[selectedProduct] + “(s).Do you want to confirm the order?”,
                      “Order Confirmation”,
                      JOptionPane.YES_NO_OPTION
                                 
                      );
             
                         if (response == JOptionPane.YES_OPTION){
                             Object [] payment = {“Cash”, “Gcash”, “PayMaya”, “Credit Card”};
                             Object selectedPayment = JOptionPane.showInputDialog(
                             null,
                                 “Select payment method: “,
                                 “Payment”,
                                 JOptionPane.PLAIN_MESSAGE,
                                 null,
                                 payment,
                                 payment[0]
                             );
                             
                           if (selectedPayment != null){
                               JOptionPane.showMessageDialog(
                               null,
                               “Order confirmed!\n” +
                               “Customer: ” + customerName + “\n” +
                               “Contact: ” + contactNumber + “\n” +
                                “Address: ” + contactAddress + “\n” +
                               “Items: ” + products[selectedProduct] + “\n” +
                               “Quantity: ” + quantity + “\n”+
                               “Payment Method: ” + selectedPayment + “\n\n” +
                               “Thank you for ordering!”
                                       );
                               
                           }else {
                               JOptionPane.showMessageDialog(null, “Payment was not selected. Order canceled.”);
                           }
                           }else{
                                 JOptionPane.showMessageDialog(null, “Your order has been canceled.”);  
                                   }
                         }
                         }else {
                                 JOptionPane.showMessageDialog(null, “PYou canceled the quantity input”);
                      }
                      }
                }

 JOptionPane.showMessageDialog(null, “Welcome to Engineering Tools Ordering System”);

        String customerName= “”;
        String contactNumber = “”;
        String contactAddress = “”;

        while(true){
        customerName = JOptionPane.showInputDialog(null, “Enter your Name: “);

          if (customerName == null || customerName.trim().isEmpty()){
              JOptionPane.showMessageDialog(null, “Name is required!”);
          }else if (!customerName.matches(“[a-zA-Z] +”)){
              JOptionPane.showMessageDialog(null, “Invalid name. Please enter letters only.”);
          }else{
              break;
    }
    }

         while(true){
        contactNumber = JOptionPane.showInputDialog(null, “Enter your Contact Number: “);

          if (contactNumber == null || contactNumber.trim().isEmpty()){
              JOptionPane.showMessageDialog(null, “Contact number is required!”);
          }else if (!contactNumber.matches(“\\d+”)){
              JOptionPane.showMessageDialog(null, “Invalid contact number. Please enter numbers only.”);
          }else{
              break;
    }
    }
         while(true){
        contactAddress = JOptionPane.showInputDialog(null, “Enter your delivery address: “);

          if (contactAddress == null || contactAddress.trim().isEmpty()){
              JOptionPane.showMessageDialog(null, “Contact delivery address is required!”);
          }else {
              int confirmAddress = JOptionPane.showConfirmDialog(
                      null,
                      “You entered: \n” +contactAddress + “\n\nAre you sure you want to send this order to this address?”,
                      “Confirm Address”,
                      JOptionPane.YES_NO_OPTION
                      );

                      if (confirmAddress == JOptionPane.YES_OPTION){
                          break;
                      }
          }
          }

                      boolean running = true;
                      while (running) {

                Object[] products = {“T-Square”, “ScientificCal”, “MechanicalCal”, “Compass”, “Protractor”};
                int selectedProduct = JOptionPane.showOptionDialog(
                    null,
                    “Please choose an item to order:”,
                    “Item Selection”,
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    products,
                    products[0]
            );

                if (selectedProduct ==JOptionPane.CLOSED_OPTION || products[selectedProduct].equals(“Exit”)){
                    running = false;
                    JOptionPane.showMessageDialog(null, “Thank you for using the Engineering Ordering System.”);
                }else{
                    String quantityString = JOptionPane.showInputDialog(null, “Enter the quantity for ” + products[selectedProduct] + “:”);

                    if (quantityString !=null){
                        int quantity =0;
                        boolean validInput = true;

                        try{
                            quantity = Integer.parseInt(quantityString);
                           if(quantity <=0){
                               validInput =false;

                        JOptionPane.showMessageDialog(null, “Pls enter a quantity greater than 0.”);
                    }
                        }catch(NumberFormatException e){
                            validInput=  false;
                            JOptionPane.showMessageDialog(null, “Invalid Input.Pls enter a valid number for quantity”);
                        }

                      if (validInput){
                          int response= JOptionPane.showConfirmDialog(
                      null,
                      “You ordered”  + quantity + ” ” + products[selectedProduct] + “(s).Do you want to confirm the order?”,
                      “Order Confirmation”,
                      JOptionPane.YES_NO_OPTION

                      );

                         if (response == JOptionPane.YES_OPTION){
                             Object [] payment = {“Cash”, “Gcash”, “PayMaya”, “Credit Card”};
                             Object selectedPayment = JOptionPane.showInputDialog(
                             null,
                                 “Select payment method: “,
                                 “Payment”,
                                 JOptionPane.PLAIN_MESSAGE,
                                 null,
                                 payment,
                                 payment[0]
                             );

                           if (selectedPayment != null){
                               JOptionPane.showMessageDialog(
                               null,
                               “Order confirmed!\n” +
                               “Customer: ” + customerName + “\n” +
                               “Contact: ” + contactNumber + “\n” +
                                “Address: ” + contactAddress + “\n” +
                               “Items: ” + products[selectedProduct] + “\n” +
                               “Quantity: ” + quantity + “\n”+
                               “Payment Method: ” + selectedPayment + “\n\n” +
                               “Thank you for ordering!”
                                       );

                           }else {
                               JOptionPane.showMessageDialog(null, “Payment was not selected. Order canceled.”);
                           }
                           }else{
                                 JOptionPane.showMessageDialog(null, “Your order has been canceled.”);  
                                   }
                         } 
                         }else{
                                 JOptionPane.showMessageDialog(null, “PYou canceled the quantity input”);
                      }
                      }
                }

      JOptionPane.showMessageDialog(null, “Hello! Welcome to Rocha’s Ordering System”);

        boolean keepOrdering = true;

        while (keepOrdering) {

            Object[] menu = {“Classic Burger”, “Cheese Burger”, “Double Burger”, “Chicken Burger”, “Fries”, “Soda”};

            int choice = JOptionPane.showOptionDialog(null,
                    “Choose your Order: “,
                    “MENU”,
                    JOptionPane.DEFAULT_OPTION,
                    JOptionPane.INFORMATION_MESSAGE,
                    null,
                    menu,
                    menu[0]
            );

            if (choice != JOptionPane.CLOSED_OPTION) {
                String quantitymenu = JOptionPane.showInputDialog(null, “Enter the quantity for ” + menu[choice] + “:”);

                    int quantity = Integer.parseInt(quantitymenu);

                    if (quantity > 0) {
                        int response = JOptionPane.showConfirmDialog(null,
                                “You ordered ” + quantity + ” ” + menu[choice] + “(s). Do you want to confirm the order?”,
                                “Order Confirmation”,
                                JOptionPane.YES_NO_OPTION
                        );

                        if (response == JOptionPane.YES_OPTION) {
                            JOptionPane.showMessageDialog(null, “Your order has been confirmed! Thank you for ordering!”);
                        } else {
                            JOptionPane.showMessageDialog(null, “Your order has been canceled.”);
                        }
                    } else {
                        JOptionPane.showMessageDialog(null, “Please enter a valid quantity greater than 0.”);
                    }

            } else {
                JOptionPane.showMessageDialog(null, “You canceled the menu option.”);
            }

            int exitResponse = JOptionPane.showConfirmDialog(null,
                    “Do you want to add another order?”,
                    “Add Another Order”,
                    JOptionPane.YES_NO_OPTION
            );

            if (exitResponse == JOptionPane.NO_OPTION) {
                keepOrdering = false;
                JOptionPane.showMessageDialog(null, “Thank you for using Rocha’s Ordering System! Goodbye.”);
            }
        }
    }
}

/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 */

package com.mycompany.mavenproject26;
import java.util.Scanner;
/**
 *
 * @author STUDENT
 */
public class Mavenproject26 {

    public static void main(String[] args) {
        System.out.println("Gunda & Alayan, Enter 5 Elements ");
        Scanner alayangunda = new Scanner (System.in);
        
        int n = 5;
        
        int [] o = new int [n];
        
        for (int i=0; i<n; i++){
            System.out.print("\nElements " + (i+1) + ":");
        
           o [i] = alayangunda.nextInt();
        }
        int lowerthan50 = 0;
        int greaterthan50 = 0;
        int equalto50 = 0;
                        for(int y=0; y< o.length; y++){
                            
                            if (o[y]>50){
                                greaterthan50++;
                            }else if (o[y]<50){
                                lowerthan50++;
                            }else{
                                equalto50++;
                               
                            }
                        }
                        System.out.println("\nThe numbers lower than 50: " + lowerthan50);
                         System.out.println("\nThe numbers greater than 50: " + greaterthan50);
                          System.out.println("\nThe numbers equal to 50: " + equalto50);
        }
                      Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
import java.util.Scanner;

public class ArrayActivity1

{
	public static void main(String[] args) {
	Scanner Names= new Scanner (System.in);
	
	System.out.println("Enter the Name Of Students: ");
	int size = Names.nextInt();
	String [] userArray = new String [size];
	
	System.out.println("Enter" + size + "Students Name:");
	
	for (int i = 0; i<size; i++){
	    System.out.println ("Students " + (i + 1) + ":" );
	    userArray[i] = Names.nextLine();
	} 
	System.out.println("\nThe Students in BSCE are: ");
	for (int i = 0; i<userArray.length; i++){
	    System.out.println ("Students " + i + ":" + userArray[i]);