0% found this document useful (0 votes)
12 views5 pages

Can't Copy and Paste This? Click Here For A Version of This Code!

YOU CAN BOOK,CANCEL,VIEW tickets HISTORY code is copyrighted and has / / limited warranties.Please see details. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.

Uploaded by

Ankit Kushwaha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Can't Copy and Paste This? Click Here For A Version of This Code!

YOU CAN BOOK,CANCEL,VIEW tickets HISTORY code is copyrighted and has / / limited warranties.Please see details. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.

Uploaded by

Ankit Kushwaha
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

YOU CAN BOOK,CANCEL,VIEW TICKETS HISTORY code: Can't Copy and Paste this?

Click here for a copy-and-paste friendly version of this code!


Terms of Agreement: By using this code, you agree to the following terms... 1. 2. 3. 4. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws. You may link to this code from another website, but ONLY if it is not wrapped in a frame. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

//************************************** // Name: RAILWAY RESERVATION // Description:YOU CAN BOOK,CANCEL,VIEW TICKETS HISTORY // By: SHASHANK SOLANKI // // Assumes:FIRSTLY DOWNLOAD JDK FILE AND BLUEJ TO USE THE APPLICATION // // Side Effects:NO `` // //This code is copyrighted and has// limited [Link] see [Link] details.//************************************** /* PROJECT ON:railway reservation COMPILED BY :shashank CLASS AND DIVISION:X ROLL NO.: ddd PROJECT STARTED ON:9/12/2006 Time: 7:00 p.m. PROJECT ENDED ON : DESCRIPTION : To Book / Cancel ticket, Display reservation chart, Search passenger number, And exit. */ import [Link].*; public class reservation { InputStreamReader isr=new InputStreamReader ([Link]); BufferedReader br=new BufferedReader (isr); //[Link]("Please enter a word"); int pno[]=new int[275]; String name[]=new String[275]; String phno[]=new String[275]; int age[]=new int[275]; int cl[]=new int[275]; int pcount=0; int pnum=1; int max1=75; int max2=125; int max3=175;

public void doMenu() throws Exception { int cho=0; do { [Link]("\f"); doHeading(); [Link]("[Link] ticket"); [Link]("[Link] ticket"); [Link]("[Link] passenger"); [Link]("[Link] chart"); [Link]("[Link] unbooked tickets"); [Link]("[Link]"); [Link]("Please enter your choice"); cho=[Link]([Link]()); switch(cho) { case 1:doBook(); break; case 2:doCancel(); break; case 3:doSearch(); break; case 4:doDispList(); break; case 5:doDispUnbooked(); break; case 6:doExit(); break; default :[Link]("Invalid choice"); } char e=(char)[Link](); }while(cho!=6); } private void doHeading()throws Exception { [Link]("######################################################## #"); [Link]("*********Railway Reservation For Kabul Express***********"); [Link]("######################################################## #"); } private void doBook()throws Exception { [Link]("Please enter the class of ticket"); [Link]("1. AC\t 2. First\t 3. Sleeper\t"); int c=[Link]([Link]()); [Link]("Please enter no. of tickets"); int t=[Link]([Link]()); int ticketAvailable=0; if(c==1 && max1>=t) { ticketAvailable=1; } if(c==2 && max2>=t)

{ ticketAvailable=1; } if(c==3 && max3>=t) { ticketAvailable=1; } if(ticketAvailable==1) { for(int i=0;i<t;i++) { pno[pcount]=pnum; [Link]("Please enter your name"); name[pcount]=[Link](); [Link]("Please enter your age"); age[pcount]=[Link]([Link]()); cl[pcount]=c; [Link]("Please enter your phno"); phno[pcount]=[Link](); pcount++; pnum++; [Link]("Ticket successfully booked"); }//for if(c==1) { max1-=t; [Link]("Please pay Rs."+t*1500); } if(c==2) { max2-=t; [Link]("Please pay Rs."+t*1200); } if(c==3) { max3-=t; [Link]("Please pay Rs."+t*1000); } } } private void doCancel()throws Exception { int t_pno[]=new int[275]; String t_name[]=new String[275]; String t_phno[]=new String[275]; int t_age[]=new int[275]; int t_cl[]=new int[275]; int t_pcount=0; int passengerFound=0; [Link]("Please enter your passenger no."); int p=[Link]([Link]()); for(int i=0;i<pcount;i++) { if(pno[i]!=p) {//transfer t_pno[t_pcount]=pno[i];

t_name[t_pcount]=name[i]; t_phno[t_pcount]=phno[i]; t_age[t_pcount]=age[i]; t_cl[t_pcount]=cl[i]; t_pcount++; } else { passengerFound=1; if(cl[i]==1) { max1++; [Link]("Please collect refund of Rs."+1800); } if(cl[i]==2) { max2++; [Link]("Please collect refund of Rs."+1500); } if(cl[i]==3) { max3++; [Link]("Please collect refund of Rs."+1000); }//else }//if } if(passengerFound==1) { pno=t_pno; name=t_name; age=t_age; cl=t_cl; phno=t_phno; pcount=t_pcount; [Link]("ticket successfully cancelled"); } }//method private void doDispList()throws Exception { [Link]("Passenger list in AC class"); [Link]("pno \t name \t\t age \t phno"); for(int i=0;i<pcount;i++) { if(cl[i]==1) { [Link](pno[i]+"\t"+name[i]+"\t\t"+age[i]+"\t"+phno[i]); } } [Link]("Passenger list in First class"); [Link]("pno \t name \t\t age \t phno"); for(int i=0;i<pcount;i++) { if(cl[i]==2) { [Link](pno[i]+"\t"+name[i]+"\t\t"+age[i]+"\t"+phno[i]); }

} [Link]("Passenger list in Sleeper class"); [Link]("pno \t name \t\t age \t phno"); for(int i=0;i<pcount;i++) { if(cl[i]==3) { [Link](pno[i]+"\t"+name[i]+"\t\t"+age[i]+"\t"+phno[i]); } } } private void doSearch()throws Exception { int passengerFound=0; [Link]("Please enter passenger no. to search"); int p=[Link]([Link]()); for(int i=0;i<pcount;i++) { if(pno[i]==p) { [Link]("Detail found"); passengerFound=1; [Link]("passenger no.="+pno[i]); [Link]("name="+name[i]); [Link]("class="+cl[i]); [Link]("phno="+phno[i]); [Link]("age="+age[i]); } }//for if(passengerFound==0) [Link]("No such passenger"); }//method private void doDispUnbooked()throws Exception { [Link]("No. of booked tickets status"); [Link]("AC class"+max1); [Link]("First class"+max2); [Link]("Sleeper class"+max3); } private void doExit() { [Link]("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); [Link]("Name : Yash , Class : X, Roll No. : 13"); [Link]("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"); } }

You might also like