Showing posts with label ICSE & ISC Projects. Show all posts
Showing posts with label ICSE & ISC Projects. Show all posts

Saturday, April 27, 2024

ICSE Project On Hotel Reservation

 This is a program on hotel reservation and similar type of programs are needed by ICSE students. In this program three String type arrays are used - one to hold hotel details like hotel name, contact number, land mark and star separated by special characters (array hotels[]), another array named hotel_rooms[] to store name of hotel, rate chart of different categories again separated by  special characters and finally the third array named hotel_amenities holds the amenities offered by different hotels.

User enters his / her choice according to land mark or star rating and the hotel details according to the choice will be displayed., 

 import java.io.*;
class Hotel_Reservation_System
{
     String hotels[]={"Trident Hotel#jaipur# Contact no.-6250021522##near Sagar Lake#5 Star Hotel",
                        "Umaid Bhawan Heritage House Hotel#Jaipur#Contact no.-9265510028# #near Jangleshwar Ji Temple#4 Star Hotel",
                         "Hotel Arya Niwas#Jaipur# Contact no.-6180054231#near St. Andrews Church#3 Star Hotel",
                          "Hotel Jaipur#jaipur#Contact no.-8974734255#near Bani Park #2 Star Hotel", 
                            "Hotel Tiwari#Jaipur#Contact no.-8974734255#near Sindhi Camp#1 Star Hotel"};                  
                       
                     
      String hotel_rooms[]={"Trident Hotel#Single 10000#Double 15000#Triple 16000#Quad 17000#Queen 18000#King 20000",
                     "Umaid Bhawan Heritage House#Single 2000#Double 3500#Triple 4000#Quad 5000#Queen 6000#King 5500",
                     "Hotel Arya Niwas#Single 1050#Double 1900#Triple 2500#Quad 3000#Queen 4000#King 4500",
                     "Hotel Jaipur#Single 950#Double 1000#Triple 1500#Quad 2050#Queen 3900#King 4000",
                     "Hotel Tiwari#Single 320#Double 420#Triple 590#Quad 780#Queen990#King 1000"};                                       
                    
                    String hotel_amenities[]={"Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#A Business Center#Onsite Dining#Fitness Center#Room Service",
                     "Banquet Hall#Restaurant Cum Bar#An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
                     "An Incredible Pool#Complimentary Wi-Fi#Business Center#Onsite Dining#Fitness Center#Room Service",
                     "Restaurant#Flat LCD TV#Rooms With Air Conditioning#Room Service",
                     "Clean Towels & Linens#TV#Self Care Products & Toiletries"};
                     String choice;
                     BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
                     
                     public void welcome() throws IOException
                     {
                         System.out.println("                WELCOME TO JAIPUR\n\n\n\n");
                         System.out.println("                PINK CITY OF  INDIA\n\n\n\n");
                         System.out.println("****************@@@@@@@@@@@@@@@@@@@@@@@@@@@@@**************");
                         System.out.println("               JAIPUR  HOTEL RESERVING SERVICE\n\n\n\n");
                         System.out.println("               We provide all type of hotels at any location of Jaipur. You can choose according to your specifications\n"+
                         "                                  and budget. \n\n\n              Customer Satisfaction is our first priority\n\n");
                     
                          System.out.println("                Press any key to enter the Booking Zone...........");
                          br.read();
                          home();
                    }              
                    
                    private void home() throws IOException
                    {
                        int ch;
                        System.out.println("                WELCOME TO HOTEL BOOKING ZONE");
                        while(true)
                        {
                        System.out.println("You can choose hotel according to STAR or Specific Land Mark. Press 1 for Star Wise Selection & 2 for Landmark:");
                       ch=Integer.parseInt(br.readLine());
                        if(ch==1 || ch==2)
                        break;
                        else
                        System.out.println("                ENTER YOUR CHOICE PROPERLY");
                    }
                    if(ch==1)
                    starHotels();
                    else
                    landMarkHotels();
                        
                    }
                    private void landMarkHotels() throws IOException
                    {
                        int i,j,k,x=0,bb,rate=0;
                        String s,s1="", roomBooked="";
                        String str[]=new String[100];
                        System.out.println("                WE HAVE HOTELS WITH FOLLOWING LAND MARKS");
                        for(i=0;i<hotels.length;i++)
                        {
                             s=hotels[i];
                             j=s.lastIndexOf('#');
                             s=s.substring(0,j);
                             j=s.lastIndexOf('#');
                             s1=s.substring(j+1);
                             for(k=0;k<x;k++)
                             {
                                 if(s1.equals(str[k]))
                                 break;
                                }
                                if(k==x)
                                {
                             System.out.println(s1);
                             str[x++]=s1;
                            }
                    }
                    System.out.println("\nEnter your Choice:");
                    choice=br.readLine();
                    System.out.println("\nMadam/Sir You can choose hotel from the followings:");
                    for(i=0;i<hotels.length;i++)
                        {
                             s=hotels[i];
                            j=s.lastIndexOf('#');
                             s=s.substring(0,j);
                             j=s.lastIndexOf('#');
                             s1=s.substring(j+1);
                             if(s1.equalsIgnoreCase(choice))
                             {
                                 while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print(s1+"***");
                                    }
                                    System.out.println("***"+s);
                                   s=hotel_rooms[i];
                                    while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print("***"+s1);
                                    }
                                    System.out.println("***"+s);
                                    s=hotel_amenities[i];
                                    while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print("***"+s1);
                                    }
                                    System.out.println("***"+s+"\n\n\n");
                                }
                            }                               
                                   // END OF if(s1.equalsIgnoreCase(choice)) 
                                   s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
                                   for(i=0;i<hotel_rooms.length;i++)
                                   {
                                       s1=hotel_rooms[i].toUpperCase();;
                                       if(s1.indexOf(s)!=-1)
                                       {
                                           bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
                                           while(true)
                                 {
                                     j=s1.indexOf('#');
                                     if(j<0)
                                     break;
                                     s=s1.substring(0,j);
                                     s1=s1.substring(j+1);
                                     System.out.println(s);
                                    }
                                    System.out.println(s1);// HOTEL ROOM S ALONG WITH RENT DISPLAYED
                                    System.out.print("\nChoose your Room:");
                                    s=br.readLine().toUpperCase();
                                    roomBooked=s;
                                    j=hotel_rooms[bb].toUpperCase().indexOf(s);                                   
                                    if(j!=-1)
                                    {
                                    k=hotel_rooms[bb].indexOf(' ',j);
                                    s=hotel_rooms[bb].toUpperCase().substring(k);
                                    j=s.indexOf('#');
                                    if(j!=-1)
                                    s1=s.substring(0,j).trim();
                                    else
                                    s1=s.substring(0).trim();                                   
                                    //s=hotel_rooms[bb].substring(k+1,j);
                                    rate=Integer.parseInt(s1);
                                }                              
                 }
            break;
        }
        displayBooking(roomBooked,rate);
                    }
                    private void starHotels() throws IOException
                    {
                        int i,j,k,x=0,bb,rate=0;
                        String s,s1="", roomBooked="";
                        String str[]=new String[100];
                        System.out.println("                WE HAVE HOTELS WITH FOLLOWING STARS");
                        for(i=0;i<hotels.length;i++)
                        {
                             s=hotels[i];
                             j=s.lastIndexOf('#');
                             s1=s.substring(j+1);
                             for(k=0;k<x;k++)
                             {
                                 if(s1.equals(str[k]))
                                 break;
                                }
                                if(k==x)
                                {
                             System.out.println(s1);
                             str[x++]=s1;
                            }
                    }
                    System.out.println("\nEnter your Choice:");
                    choice=br.readLine();
                    System.out.println("\nMadam/Sir You can choose hotel from the followings:");
                    for(i=0;i<hotels.length;i++)
                        {
                             s=hotels[i];
                             j=s.lastIndexOf('#');
                             s1=s.substring(j+1);
                             if(s1.equalsIgnoreCase(choice))
                             {
                                 while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print(s1+"***");
                                    }
                                    System.out.println("***"+s);
                                   s=hotel_rooms[i];
                                    while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print("***"+s1);
                                    }
                                    System.out.println("***"+s);
                                    s=hotel_amenities[i];
                                    while(true)
                                 {
                                     j=s.indexOf('#');
                                     if(j<0)
                                     break;
                                     s1=s.substring(0,j);
                                     s=s.substring(j+1);
                                     System.out.print("***"+s1);
                                    }
                                    System.out.println("***"+s+"\n\n\n");
                                }
                            }                                
                                   // END OF if(s1.equalsIgnoreCase(choice)) 
                                   s=br.readLine().toUpperCase();// CHOOSEN HOTEL IS ENTERED
                                   for(i=0;i<hotel_rooms.length;i++)
                                   {
                                       s1=hotel_rooms[i].toUpperCase();;
                                       if(s1.indexOf(s)!=-1)
                                       {
                                           bb=i;/* HOLDS THE INDEX OF THE SELECTED HOTEL IN ALL THE THREE ARRAYS*/
                                           while(true)
                                 {
                                     j=s1.indexOf('#');
                                     if(j<0)
                                     break;
                                     s=s1.substring(0,j);
                                     s1=s1.substring(j+1);
                                     System.out.println(s);
                                    }
                                    System.out.println(s1);/* HOTEL ROOM S ALONG WITH RENT DISPLAYED*/
                                    System.out.print("\nChoose your Room:");
                                    s=br.readLine().toUpperCase();
                                    roomBooked=s;
                                    j=hotel_rooms[bb].toUpperCase().indexOf(s);                                   
                                    if(j!=-1)
                                    {
                                    k=hotel_rooms[bb].indexOf(' ',j);
                                    s=hotel_rooms[bb].toUpperCase().substring(k);
                                    j=s.indexOf('#');
                                    if(j!=-1)
                                    s1=s.substring(0,j).trim();
                                    else
                                    s1=s.substring(0).trim();
                                    
                                    //s=hotel_rooms[bb].substring(k+1,j);
                                    rate=Integer.parseInt(s1);
                                }                                
                   }
    break;
        }
        displayBooking(roomBooked,rate);       
    }
    private void displayBooking(String s, int rate) throws IOException
    {
       System.out.println("\nEnter Date of Boarding (DD/MM/YYYY):");
        String day1=br.readLine();
        System.out.println("\nEnter Date of Leaving The Hotel (DD/MM/YYYY):");
        String day2=br.readLine(); 
        System.out.println("\nEnter Number of Rooms Needed:");
        String no1=br.readLine();
        System.out.println("\nEnter Number of Persons:");
        String no2=br.readLine();
        System.out.println("\n\nBOOKING CONFIRMED:");
        System.out.println("\n"+ no1 + " "+ s + " "+ "Room / Rooms booked for "+ no2 + " Number of Persons from \n"+ day1 + " to "+ day2);
        System.out.println("\n Total Rental Charge Including GST Rs. "+ rate*Integer.parseInt(no1));
        System.out.println("\n Room Numbers will be alloted at the time of boarding.");
        System.out.println("\n Check In Time 12.00 noon and Check Out Time 11.00 AM");      
                
    }

}

Saturday, November 14, 2020

ICSE BlueJ Project On Restaurant (2)

   import java.util.*;
class Restaurant
{
 String item[]={"Pasta","Cheese Pizza","Mini Burgers with Cheeze","Corn Dogs","Grilled Chicken","Chicken soup","Tomato soup","Meatloaf","Lasagna","Spaghetti with meatballs","Chicken parmesan","Chicken Pesto","Chrispy Popcorn","Tempura Green Beans","Double Decker Chicken","Pav Bhaji","Giant chocolate chip cookies","Banana split","Apple Cobbler","Samosa"};
 double rate[]={100,102,103,104,105,95,50,100,85,150,130,110,106,107,108,50,100,50,60,10};
 String order[]=new String[10];
 double amt[]=new double[10];
 String ans;
 int plates[]=new int[10];
 int i,n=0,no,x=0;
 Scanner sc=new Scanner(System.in);
 Restaurant()
 {
  
 } 
 
 public void init()
 {
     System.out.println("*********************WELCOME TO MAJI'S CANTEEN*************************\n\n\n");
      System.out.println("\n\n\n*************MENU CARD************\n\n\n");
      System.out.println("*********************************************");
      System.out.println("Item No.         Item            Rate/plate");
      for(i=0;i<20;i++)
      {
                System.out.println((i+1)+ ":                "+item[i]+"------------------"+rate[i]);
      }
       System.out.println("\nFor Purchase of Rs. 500 or More, 12.5% Discount ");         
     while(true)
     {
          if(x==20)
          break;
         System.out.println("Enter item number:");
         no=sc.nextInt();
         order[x]=item[no-1];
         amt[x]=rate[no-1];
         System.out.println("How many plates?:");
         no=sc.nextInt();
         plates[x]=no;
         x++;
         sc=new Scanner(System.in);
           System.out.println("Any More Item ?(Y/N):");
        ans=sc.nextLine().toUpperCase();
             if(ans.equals("N"))
             break;
 }
 display();
}
private void display() 
{
double bamt=0,b;
  System.out.println("You have ordered\n");
   System.out.println("Item       Rate         No. of Plates");
  for(i=0;i< x;i++)
  {
       System.out.println((i+1)+":"+order[i]+"---"+amt[i]+"---"+plates[i]);
    }   
        
         System.out.println("MAJI'S CANTEER\nCash Memo\n");        System.out.println("*****************************************************************");
        System.out.println("Item          No. of plates      Rate           Amount\n");         System.out.println("***************************************************************");
         for (i=0;i<x;i++)
         {
               System.out.print(order[i]+ "             "+plates[i]+ "              "+ amt[i]+ "                      ");      
        b=plates[i]*amt[i];
         System.out.println(b);
         bamt=bamt+b;
        }
         System.out.println("Bill Amount (Including All) Rs.                                     "+bamt);
          System.out.println("*******************");
          if(bamt>=500)
          System.out.print("Total Amount after discount @ 12.5% Rs.                  ");
          else
          System.out.print("Total Amount Rs.                   ");
          if (bamt>=500)
          bamt=bamt-bamt*.125;
          System.out.println(bamt);        
}
public static void main(String args[]) throws Exception
{
Restaurant ob=new Restaurant();
 ob.init();
}
}


Variable description of the program




String item[] holds the items in the menu
double rate[] holds the rate of the items of menu card
String order[] it holds the items ordered by any customer
double amt[] it holds the price of items ordered
String ans It takes the choice of customer whether any more order is to be taken
int plates[] it holds the number of plates of each items ordered by customer
int x customer has to order atleast two items, ‘x’ keeps track of the number of items ordered.
int no items are ordered using the item number. ‘no’ holds the item number.
int i loop control variable.
double bamt holds the total bill amount
BufferedReader br It is used to take user input

*/


Sunday, November 3, 2019

ICSE Project on Menu Driven Program With 20 Patterns

This is a BlueJ Menu Driven Program to check choice from user (1-20) and display different patterns. The programs ends when the user enters 0


import java.util.Scanner;
class Max
{
    Scanner sc=new Scanner(System.in);
    void takeChoice()
{
    int ch;
        System.out.print("\nUser will enter choice between 1 to 20 to display different patterns\nIf '0' is entered, the program will be terminated");
    do
    {
        System.out.println("\n\nEnter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):");
        ch=sc.nextInt();
        switch(ch)
        {
             case 1:
                    pattern1();
                    break;
             case 2:
                    pattern2();
                    break;
             case 3:
                    pattern3();
                    break;
             case 4:
                    pattern4();
                    break;
             case 5:
                    pattern5();
                    break;
             case 6:
                    pattern6();
                    break;
             case 7:
                    pattern7();
                    break;
             case 8:
                    pattern8();
                    break;
             case 9:
                    pattern9();
                    break;
             case 10:
                    pattern10();
                    break;


             case 11:
                    pattern11();
                    break;
             case 12:
                    pattern12();
                    break;
             case 13:
                    pattern13();
                    break;
             case 14:
                    pattern14();
                    break;
             case 15:
                    pattern15();
                    break;
             case 16:
                    pattern16();
                    break;
             case 17:
                    pattern17();
                    break;
             case 18:
                    pattern18();
                    break;
             case 19:
                    pattern19();
                    break;
             case 20:
                    pattern20();
                    break;
             case 0:
                   System.out.print("\nEnd of Program...");
                   break;
             default:   
                   System.out.print("\nEnter Your Choice Properly (1-20).");
                   
        }
               
    }while(ch!=0);
}
private void pattern1()
{

int i,j,x=1;
for ( i=0;i<=5;i++)
{
for(j=0;j<=i;j++)
{
System.out.print(x);
if(x>0)
x--;
else
x++;
}
System.out.println();
}
}

private void pattern2()
{
   int x;
   for(int i=0;i<=4;i++)
    {
for(int j=i;j<=4;j++)
{
    x=5-i;
System.out.print(x);
}
System.out.println();
}
}

 private void pattern3()
{
    int i,j,x;
for(i=0;i<=4;i++)
{
x=1;
for(j=0;j<=4;j++)
{
if(i+j==4)
System.out.print("*");
else
System.out.print(x++);
}
System.out.println();
}
}

  private void pattern4()
{
int i,j,x,y=1;
for( i=0;i<=2;i++)
{
x=y;
for(j=0;j<=i;j++)
{
System.out.print("        "+x);
x=x-2;
}
System.out.println();
y=y+2;
}
 }

 private void pattern5()
{
 int x;
for(int i=0;i<=4;i++)
{
x=6;
for(int j=0;j<=i;j++)
{
System.out.print(" "+x);
x=x+6;
}
System.out.println();
}
}

private void pattern6()
{
for(int i=0;i<=4;i++)
{
int x=5;
for(int j=0;j<=4;j++)
{
System.out.print(x+ " ");
if(j
x=x-1;
}
System.out.println();
}
}

private void pattern7()
{
    int x;
for(int i=1;i<=4;i++)
{
x=1;
for(int j=1;j<=6;j++)
{
System.out.print(" "+x);
x=x+i;
}
System.out.println();
}
}

private void pattern8()
{
 for(int i=0; i<=3; i++)
{
for(int j=0; j<=i; j++)
{
System.out.print(i+" ");
}
System.out.println();
}
}

private void pattern9()
{  
 for(int i=0; i<=3; i++)
{
for(int j=0; j<=i; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}

private void pattern10()
{
    for(int i=0; i<=3; i++)
{
for(int j=i; j<4 j="" o:p="">
{
System.out.print(i+" ");
}
System.out.println();
}
}

private void pattern11()
{
    for(int i=0; i<=3; i++)
{
for(int j=i; j<=3; j++)
{
System.out.print(j+" ");
}
System.out.println();
}
}

private void pattern12()
{
   int x=1;
 for(int i=0; i<=3; i++)
{
for(int j=0; j<=i; j++)
{
System.out.print(x+" ");
x++;
}
System.out.println();
}
}

private void pattern13()
{
   int x=1;
 for(int i=0; i<=3; i++)
{
for(int j=i; j<=3; j++)
{
System.out.print(x+" ");
x++;
}
System.out.println();
}
}

private void pattern14()
{
   int x=1;
 for(int i=0; i<=3; i++)
{
for(int j=i; j<=3; j++)
{
 if (x<10 o:p="">
System.out.print("0"+x+" ");
else
System.out.print(x+" ");
x++;
}
System.out.println();
}
}

 private void pattern15()
{
    for(int i=0; i<=3; i++)
{
for(int j=0; j<=3; j++)
{
System.out.print('@');
}
System.out.println();
}
}

private void pattern16()
{
    int x=1;
for(int i=0;i<=6;i++)
{
for(int j=0;j<=x-1;j++)
{
System.out.print("*");
}
if(i< 7/2)
x++;
else
x--;
System.out.println();
}
}

private void pattern17()
{
String s1;
int i,j,len,sp=0,c,s=1;
s1="Suddhashil Chakraborty";
len=s1.length()-1;
for(i=0;i<=len;i++)
{
if(s1.charAt(i)==' ')
s++;
}
while(true)
{
c=0;
if (s==sp)
break;
sp++;
for(i=0;i<=len;i++)
{
if(s1.charAt(i)==' ')
c++;
if(c==sp)
break;
System.out.print(s1.charAt(i));
}
System.out.println();
}
}

private void pattern18()
{
int i,j,len;
String s1="INDIA";
len=s1.length()-1;
for(i=0;i<=len;i++)
{
for(j=0;j
{
System.out.print(s1.charAt(j));
}
System.out.println();
}
}

private void pattern19()
{
int i,j,len;
String s1="BLUEJ";
len=s1.length();
for (i=len-1;i>=0;i--)
{
for(j=len-1;j>=i;j--)
System.out.print(s1.charAt(i));
System.out.println();
}
}

private void pattern20()
{
int i,j,len;
String s="BLUEJ";
len=s.length()-1;
for(i=0; i <=len; i++)
{
 for(j=0;j<= i;j++)
{
System.out.print(s.charAt(i));
}
System.out.println();
}
}

public static void main(String args[])
{
Max ob=new Max();
ob.takeChoice();
}
}

Sample Input Output

User will enter choice between 1 to 20 to display different patterns
If '0' is entered, the program will be terminated

Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
1
1
01
010
1010
10101
010101


Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
54

Enter Your Choice Properly (1-20).

Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
2
55555
4444
333
22
1


Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
6
5 5 5 5 5
5 4 4 4 4
5 4 3 3 3
5 4 3 2 2
5 4 3 2 1


Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
7
 1 2 3 4 5 6
 1 3 5 7 9 11
 1 4 7 10 13 16
 1 5 9 13 17 21


Enter Choice (1-14 for numberic pattern, 15-16 for character pattern and 17-20 for pattern on string, 0 for exit):
0

End of Program...


Variable Description

Type of Variable
Name of Variable
Description
int
ch
This variable holds user choice
int
i
Loop Control variable
int
j
Loop control variable
Int
x
This variable is used inside loops of function body to display numbers in the pattern
int
len
This variable is used inside pattern displaying function body to hold length of string
Scanner
sc
Input object
String
s
This object is used inside pattern displaying function body to hold  string value
String
s1
This object is used inside pattern displaying function body to hold  string value


Subscribe via email

Enter your email address:

Delivered by FeedBurner