Thursday, February 14, 2019

2019 ISC Computer Practical Paper



Question2




Write a program to declare a single dimensional array a[] and a square matrix b [][] of size N, where N is greater than 2 and at the same time N is less than 12

Perform the following tasks on the matrix

(a) Sort the elements of the single dimensional array in ascending order using any standard sorting technique and display the sorted elements.

(b) Fill the square matrix b[][] in the following format.

If the array a[]={5,2,8,1} then, after sorting a[]= {1,2,5,8}

Then the matrix b[][] would fill as below:

1  2  5  8
1  2  5  1
1  2  1  2
1  1  2  5


Sample Input and Output



INPUT: N=3

ENTER ELEMENTS OF SINGLE DIMENSIONAL ARRAY: 3 1 7

OUTPUT:

SORTED ARRAY: 1 3 7

FILLED MATRIX

1  3  7

1  3  1

1  1  3

INPUT: N=13

MATRIX SIZE OUT OF RANGE



import java.io.*;
class Mat
{
int a[], N,b[][];
public void takeValues()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i;
System.out.print("\nENTER N=");
N=Integer.parseInt (br.readLine());
if (N<=1 || N>=12)
{
System.out.print("\nMATRIX SIZE OUT OF RANGE");
return;
}
a=new int[N];
b=new int[N][N];
for(i=0;i<=N-1;i++)
{
System.out.print("\nINPUT:");
a[i]=Integer.parseInt (br.readLine());
}
arrange();
}
private void arrange() 
{
int i,j,k,x,temp;
for(i=0;i<=N-2;i++)
{
for(j=i+1;j<=N-1;j++)
{
if(a[i]>a[j])
{
 temp=a[i];
 a[i]=a[j];
 a[j]=temp;
}
}
}

System.out.print("\nSORTED ARRAY\n");
for(i=0;i<=N-1;i++)
System.out.print(a[i]+" ");
for(i=0;i<=N-1;i++)
{
 for(j=0;j<=N-1-i;j++)
 {
      b[i][j]=a[j];
 }
 x=j;
 for(k=0;k<=i-1;k++)
 {
      b[i][x++]=a[k];
    }
}

 System.out.print("\nFILLED MATRIX\n");
 for(i=0;i<=N-1;i++)
 {
      for(j=0;j<=N-1;j++)
      {
         System.out.print(b[i][j]+" "); 
        }
   System.out.println();     
}
}

public static void main(String args[]) throws IOException
{
Mat ob=new Mat();
ob.takeValues();
}
}


In this program, the sorted 1-d array elements are stored in the 1st row of the 2-d array. Then in the second row, all elements of the 1-d array excepting the last are stored and the last location is filled with the first element of the 1-d array. Similarly, in the third row, all elements of the 1-d array excepting the last two elements are stored and the last two locations are filled with the first two elements of the 1-d array and so on.


Yet to receive the question paper. All solutions will be posted.

Monday, February 4, 2019

ISC 2019 English Paper II Suggestions (New Syllabus)



Section A
(Answer any one question)
Tempest-Shakespeare

Question 1

Choose two of the passages (a) to (c) and answer briefly the question that follows:
       a)       Miranda : How came we ashore?
Prospero: By providence divine
Some food we had and some fresh water that
A noble Neapolitan, Gonzalo,
Out of his charity, who being then appointed
Master of this design, did give us, with
Rich garments, linens, stuffs, and necessaries,
Which since have steaded much. So, of his gentleness,
Knowing I loved my books, he furnished me
From mine own library with volumes that
I prize above my dukedom.

i)        Who are Prospero and Miranda? Where are they at this moment?                                          
ii)       Give a brief character sketch of the person who helped Prospero and Miranda.
iii)     Why have they come to the place they are at present?
iv)     Why was Prospero expelled?
v)      What idea can you form of Miranda?
vi)     What idea can you form of Prospero?                                                                  (1+2+2+2+2+1)


b)   Prospero: This blue-eyed hag was hither brought with child
And here was left by th' sailors. Thou, my slave,
As thou report’st thyself, wast then her servant.
And, for thou wast a spirit too delicate
To act her earthy and abhorred commands,
Refusing her grand hests, she did confine thee,
By help of her more potent ministers
And in her most unmitigable rage,
Into a cloven pine, within which rift
Imprisoned thou didst painfully remain
A dozen years; within which space she died
And left thee there, where thou didst vent thy groans
As fast as mill wheels strike. Then was this island—
Save for the son that she did litter here,
A freckled whelp hag-born—not honored with
A human shape.
            
i)        Who is Prospero talking to?
ii)       Give the context of the conversation.
iii)    Explain “thou wast a spirit too delicate”.
iv)    Who is the “blue-eyed hag”?
v)      What idea do you form of the relationship between Prospero and the “spirit”?
vi)     vi)  Who is the “son” referred to here?                                  (1+2+2+2+2+1)

c)  Caliban: “'Ban, 'Ban, Ca-caliban
Has a new master. Get a new man.
Freedom, high-day, high-day, freedom, freedom, high-day, freedom!”

i) From where the extract has been taken?
ii) Who is the “new master” ?
iii) Give an account of Caliban’s use of words like “master” and “freedom” .
iv)  Who is Caliban?
v) How does Caliban look like?
vi)  Whom is Caliban talking to?                                                                             (1+2+2+2+2+1)



Candida- George Bernard Shaw
Question 2

Choose two of the passages (a) to (c) and answer briefly the question that follows:

a) Morell: “And remember; we are friends, and need not fear that either of us will be anything but patient and kind to the other, whatever we may have to say.”
Marchbanks:  (twisting himself round on him): “Oh, I am not forgetting myself: I am only (covering his face desperately with his hands) full of horror. (Then, dropping his hands, and thrusting his face forward fiercely at Morell, he goes on threateningly.) You shall see whether this is a time for patience and kindness. (Morell, firm as a rock, looks indulgently at him.) Don't look at me in that self-complacent way. You think yourself stronger than I am; but I shall stagger you if you have a heart in your breast.”
i) Where are Morell and Marchbanks? What is their relationship?
ii) What is the “horror” of Marchbanks?
iii) Give a brief context of this conversation.
iv) Who is Marchbanks?
v) What is Marchbanks proposing to say?
vi) Define “I shall stagger you”.                                                                                  (1+2+2+2+2+1)

b) Candida: “…Wouldn’t you like to present me with a nice new brush, with an ivory back, decorated with pearls? “
Marchbanks: (softly and musically, but sadly and longingly) “No, not a scrubbing brush, but a boat: a tiny boat to sail away in, far from the world, where the marble floors are washed by the rain and dried by the sun…”
i) Who is Candida?
ii) What is the relationship that Candida shares with Marchbanks?
iii) What is the significance of the “boat”?
iv) How is Marchbanks’s narrative different from that of Morell?
v) Define the romantic elements in Marchbanks’s speech and how it complies with his identity of a poet?
vi) Where are the two characters?                                                                 (1+2+2+2+2+1)

c) Morell: “(with proud humility)I have nothing to offer you except my strength for your defence, my honesty for your security , my ability and hard-work for your livelihood, and my authority and position for your respect in society. “
i) Who is Morell?
ii) Where does the scene take place?
iii) Whom is Morell talking to and what is the context?
iv) Explain “nothing to offer”.
v) What does Marchbanks say in this very context?
vi) Explain Candida’s reaction to this statement of Morell.                                                 (1+2+2+2+2+1)


Section B
(Answer four questions on at least three textbooks which may include either The Tempest or Candida)
The Tempest- Shakespeare
Question 3

(a) Describe the opening scene of Tempest.                                                                           (8)
(b) Give a vivid description of Miranda’s first meeting with Ferdinand.                             (6)
(c) Sketch the character of Ariel.                                                                                                (6)
Question 4
Explain the critical master-slave relationship that exists in The Tempest.                         (20)
Candida- George Bernard Shaw
Question 5

(a)  Explain the appropriateness of the title ‘Candida’.                                                           (8)    
(b) How does Marchbanks’s character highlight the character of Candida?                       (6)
(c) Define the ending of Candida.                                                                                                (8)

Question 6

How does Shaw bring forth his iconoclastic ideas in Candida?                        (20)

Things Fall Apart- Achebe
Question 7

(a) How is the society presented in Things Fall Apart?                                              (8)
(b) How is the character of Unoka different from that of Okonkwo?                     (6)
(c) Depict the arrival of the white man.                                                                        (6)

Question 8

How is the theme of colonization depicted in the novel Things Fall Apart?             (20)

Question 9

Describe the treatment of women and children in Things Fall Apart.                        (20)

Contemplations
Question 10

(a) Explain Tagore’s idea of education in The Voice of Humanity.                                   (8)
(b) Describe the boon and bane of Europe according to Tagore.                                     (6)
(c) Does Tagore applaud the rise of science? Substantiate.                                               (6)

Question 11

Analyse Bacon’s art of writing with reference to the text in the syllabus.                                       (20)

Question 12

Bring out the appropriateness of the title On the Decay of the Art of Lying by Mark Twain.      (20)

Echoes
Question 13

(a) Briefly describe Dahl’s art of narration in the short story ‘The Sound Machine’.             (8)
(b) Give a brief note on Klausner’s obsession with his machine.                                                (6)
(c) Comment on the ending of the story.                                                                                        (6)

Question 14

Explain how Ray’s narrative manages to amaze and puzzle the reader at the same time. Substantiate your idea of Fritz’s identity.                                                                                                                (20)

Question 15

How do a number of themes inter-cross in Jeffrey Archer’s ‘The Chinese Statue’?                 (20)

Reverie
Question 16

(a) How does the narrator seem to have acquired knowledge through nature in ‘Birches’?            (8)
(b) Analyse Frost’s usage of imageries in ‘Birches’.                                                                                    (6)
(c) How does the poem oscillate between truth and imagination?                                                    (6)
Question 17
Analyse Sarojini Naidu’s ‘The Gift of India’ to be both a war poem as well as an Indian poem.         (20)
Question 18
Comment on the loss of faith as reflected in the poem ‘Dover Beach’ by Mathhew Arnold.              (20)


For Answers: CLICK HERE

Friday, February 1, 2019

Simple Banking Transaction BlueJ Program



Name, Account Number  and Initial Balance are taken and minimum balance amount is Rs. 3000.
Transactions (deposit and withdrawal) continues till user stops it and loan can be sanctioned.

import java.io.*;

class Bank

{

String name,acno;
double amount,loan;
String date1;
/* 'name' to hold name, 'amount' will hold initial amount, 'acno' will hold account number, 'loan' will hold the loan taken (if any) 'date1' holds the dates of transactions */

BufferedReader br;

Bank()
{
br=new BufferedReader(new InputStreamReader(System.in));
}

private void initial()throws IOException
{
System.out.println("Date of opening Account(dd/mm/yyyy):");
date1=br.readLine().toUpperCase();

System.out.println("Name with Surname:");
name=br.readLine().toUpperCase();

System.out.println("A/c No.:");
acno=br.readLine().trim();

System.out.println("Initial Amount:");
amount=Double.parseDouble(br.readLine());
}

private void transaction()throws IOException

{

double amount1; 
String dep1;
String pat;

/* 'amount1' will hold the transaction amount, 'dep1' will hold mode of transaction,  */

System.out.println("Date of transaction (dd/mm/yyyy):");
date1=br.readLine().trim();

System.out.println("Enter the transaction type(d for deposit/w for withdrawal):");
dep1=br.readLine().trim().toLowerCase();

System.out.println("Enter the amount:");
amount1=Double.parseDouble(br.readLine());

if(dep1.equals("w"))
{
if(amount-amount1<3000 font="">
{
System.out.println("Insufficient Balance");
}

else
{
amount=amount-amount1;
}
}

else if(dep1.equals("d"))
{
amount=amount+amount1;
}
}

private void loan()throws IOException
{
double amount1; 
System.out.println("Date of taking loan (dd/mm/yyyy):");
date1=br.readLine().trim();

System.out.println("Enter the loan amount:");
amount1=Double.parseDouble(br.readLine());

if(amount1>amount-3000)
{
System.out.println("Insufficient Balance, Not possible to grant loan of Rs."+ amount1);
}

else
{
amount=amount-amount1;
}
}

private void display()

{
System.out.println("\n\n\nDate="+date1);
System.out.println("Name of the A/C holder="+name);
System.out.println("A/c No.:"+acno);
System.out.println("Balance Rs:"+amount);
System.out.println("*******************\n");
}


public void main()throws IOException

{

char ans='y';

Bank ob=new Bank();

ob.initial();
System.out.println("New Account Opened:");
ob.display();
while(ans!='n')
{
ob.transaction();
ob.display();
System.out.println("Any More(Yes/No:):");

ans=br.readLine().toLowerCase().charAt(0);

}
System.out.println("Opted for Loan (Yes/No):"); 
ans=br.readLine().toLowerCase().charAt(0);
if(ans=='y')
{
ob.loan();
ob.display();
}
}
}

Friday, November 30, 2018

Airlines Ticket Booking Program - ICSE Project on BlueJ




 This can be a project work for ICSE students. In this program the operator will enter the name, age, address etc of the passengers and  ticket will be issued with name, address, age, gender, fare etc. In this program we will use only four airlines.





import java.io.*;

class AirTicket

{

 int i,x=0,index=0,w=0;

  int c=0;



// FOR FIRST AIRLINES (INDIGO)



 String names[], address[], contact[],gender[];

 String wnames[], waddress[], wcontact[],wgender[];

 String stations[]={"Kolkata", "Bombay", "Chennai", "Bangalore"};

 int distance[]={0,1305,2014,1678,1886};

 int age[],wage[];

   String ans, start,end;

 String fare[]={"Kolkata - Delhi - 6000", "Kolkata - Bombay - 7010", "Kolkata - Chennai - 7160", "Kolkata - Bangalore - 6200" };



 // FOR SECOND AIRLINES (SPICEJET)



 String names2[], address2[], contact2[],gender2[];

 String wnames2[], waddress2[], wcontact2[],wgender2[];

 String stations2[]={"Kolkata", "Bombay", "Chennai", "Bangalore"};

 int distance2[]={0,1305,2014,1678,1886};

 int age2[],wage2[];

   String ans2, start2,end2;

 String fare2[]={"Kolkata - Delhi - 6300", "Kolkata - Bombay - 7310", "Kolkata - Chennai - 7560", "Kolkata - Bangalore - 6800" };



 //FOR THIRD AIRLINES (AIR INDIA)



 String names3[], address3[], contact3[],gender3[];

 String wnames3[], waddress3[], wcontact3[],wgender3[];

 String stations3[]={"Kolkata", "Bombay", "Chennai", "Bangalore"};

 int distance3[]={0,1305,2014,1678,1886};

 int age3[],wage3[];

   String ans3, start3,end3;

 String fare3[]={"Kolkata - Delhi - 6700", "Kolkata - Bombay - 7710", "Kolkata - Chennai - 7260", "Kolkata - Bangalore - 6900" };





 // FOR FOURTH AIRLINES (GOAIR)



 String names4[], address4[], contact4[],gender4[];

 String wnames4[], waddress4[], wcontact4[],wgender4[];

 String stations4[]={"Kolkata", "Bombay", "Chennai", "Bangalore"};

 int distance4[]={0,1305,2014,1678,1886};

 int age4[],wage4[];

   String ans4, start4,end4;

 String fare4[]={"Kolkata - Delhi - 6100", "Kolkata - Bombay - 7610", "Kolkata - Chennai - 7560", "Kolkata - Bangalore - 6100" };





  BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

  int booked[]=new int[100];

 int booked2[]=new int[100];

int booked3[]=new int[100];

 int booked4[]=new int[100];

 int booked5[]=new int[100];



  AirTicket()

  {

      names=new String[100];

      address=new String[100];

      contact=new String[100];

      gender=new String[100];

      age=new int[100];

   



      wnames=new String[100];

      waddress=new String[100];

      wcontact=new String[100];

      wgender=new String[100];

      wage=new int[100];



      for(int i=0;i< 100;i++)

       booked[i]=-1;



             // second Airlines



   



       names2=new String[100];

      address2=new String[100];

      contact2=new String[100];

      gender2=new String[100];

      age2=new int[100];



   

      wnames2=new String[100];

      waddress2=new String[100];

      wcontact2=new String[100];

      wgender2=new String[100];

      wage2=new int[100];



      for(int i=0;i< 100;i++)

       booked2[i]=-1;

   



       //third

 



       names3=new String[100];

      address3=new String[100];

      contact3=new String[100];

      gender3=new String[100];

      age3=new int[100];

   



      wnames3=new String[100];

      waddress3=new String[100];

      wcontact3=new String[100];

      wgender3=new String[100];

      wage3=new int[100];



      for(int i=0;i< 100;i++)

       booked3[i]=-1;



         



       // fourth



   



       names4=new String[100];

      address4=new String[100];

      contact4=new String[100];

      gender4=new String[100];

      age4=new int[100];



   

      wnames4=new String[100];

      waddress4=new String[100];

      wcontact4=new String[100];

      wgender4=new String[100];

      wage4=new int[100];



      for(int i=0;i< 100;i++)

       booked4[i]=-1;       

   



    }



    public void takeData() throws Exception

    {

       int lines; 

       System.out.println("Enter 1 for INDIGO , 2 for SPICEJET \n 3 for AIR INDIA, 4 for Punjab GOAIR");

       lines=Integer.parseInt(br.readLine());



       if (lines==1)

       first();



       else if(lines==2)

       second();



      else if(lines==3)

       third();



       else if(lines==4)

       fourth();   

        }



 

        void first() throws Exception

        {     

   

       System.out.print("\nBoarding At:");



       for(i=0;i< stations.length;i++)

       System.out.print("    "+stations[i]);

              System.out.print(" :");



       start=br.readLine();



            System.out.print("\nDestination:");

       for(i=0;i< stations.length;i++)



       System.out.print("    "+stations[i]);

              System.out.print(" :");



       end=br.readLine();

       start=start + " - "+ end;



         while(true)

         {

             System.out.print("\nName:");

             names[x]=br.readLine();

             if(c==0)

             {

             System.out.print("\nAddress:");

             address[x]=br.readLine();

            }



            else

            address[x]=address[x-1];



             System.out.print("\nAge:");

            age[x]=Integer.parseInt(br.readLine());



            System.out.print("\nGender:");

             gender[x]=br.readLine();



             c++;

             x++;

             if(c==6)

             break;



             System.out.print("\nAny More Member (y/n):");

             ans=br.readLine();



             if(ans.equalsIgnoreCase("N"))

             break;

            }   



         show1();



        }



        void second() throws Exception

        {           



       System.out.print("\nBoarding At:");

       for(i=0;i< stations2.length;i++)

       System.out.print("    "+stations2[i]);

              System.out.print(" :");



       start2=br.readLine();   



      System.out.print("\nDestination:");

       for(i=0;i< stations2.length;i++)

       System.out.print("    "+stations2[i]);

              System.out.print(" :");



       end2=br.readLine();



       start2=start2 + " - "+ end2;



         while(true)

         {

             System.out.print("\nName:");

             names2[x]=br.readLine();



             if(c==0)

             {

             System.out.print("\nAddress:");

             address2[x]=br.readLine();

            }



            else

            address2[x]=address2[x-1];



             System.out.print("\nAge:");

            age2[x]=Integer.parseInt(br.readLine());



            System.out.print("\nGender:");

             gender2[x]=br.readLine();



             c++;

             x++;



             if(c==6)

             break;



             System.out.print("\nAny More Member (y/n):");

             ans=br.readLine();



             if(ans.equalsIgnoreCase("N"))

             break;

            }



                  show2();



        }



     



        void third() throws Exception

        { 



           System.out.print("\nBoarding At:");

       for(i=0;i< stations3.length;i++)

       System.out.print("    "+stations3[i]);

              System.out.print(" :");

       start3=br.readLine();

   



      System.out.print("\nDestination:");

       for(i=0;i< stations3.length;i++)

       System.out.print("    "+stations3[i]);

       System.out.print(" :");

       end3=br.readLine();



       start3=start3 + " - "+ end3;



         while(true)

         {

             System.out.print("\nName:");

             names3[x]=br.readLine();



             if(c==0)

             {

             System.out.print("\nAddress:");

             address3[x]=br.readLine();

            }



            else

            address3[x]=address3[x-1];



             System.out.print("\nAge:");

            age3[x]=Integer.parseInt(br.readLine());



            System.out.print("\nGender:");

             gender3[x]=br.readLine();



             c++;

             x++;



             if(c==6)

             break;



             System.out.print("\nAny More Member (y/n):");

             ans=br.readLine();



             if(ans.equalsIgnoreCase("N"))

             break;

            }     



         show3();



        }

         



        void fourth() throws Exception 



        {     

   

       System.out.print("\nBoarding At:");

       for(i=0;i< stations4.length;i++)

       System.out.print("    "+stations4[i]);

              System.out.print(" :");

       start4=br.readLine();



   

      System.out.print("\nDestination:");

       for(i=0;i< stations4.length;i++)

       System.out.print("    "+stations4[i]);

              System.out.print(" :");

       end4=br.readLine();



       start4=start4 + " - "+ end4;



         while(true)

         {

             System.out.print("\nName:");

             names4[x]=br.readLine();



             if(c==0)

             {

             System.out.print("\nAddress:");

             address4[x]=br.readLine();

            }



            else

            address4[x]=address4[x-1];



             System.out.print("\nAge:");

            age4[x]=Integer.parseInt(br.readLine());



            System.out.print("\nGender:");

             gender4[x]=br.readLine();



             c++;

             x++;

             if(c==6)

             break;



             System.out.print("\nAny More Member (y/n):");

             ans=br.readLine();



             if(ans.equalsIgnoreCase("N"))

             break;

            }

                show4();



        }

   





    void show1() throws Exception

    {

       String s;

       int famt1=0,famt=0;

       index=0;

         

        for(i=0;i<  fare.length;i++)

        {

          s=fare[i];

          index=s.lastIndexOf("-");

          famt1=Integer.parseInt(s.substring(index+1).trim());

          s=s.substring(0,index).trim();

   

          if(start.equalsIgnoreCase(s))     



          break;

        }     



     for(i=0;i< 100;i++)

     {

          if(booked[i]< 0)

          index++;

        }

         if (x > index)

         {

             System.out.println("Sorry, No Ticket");         



        }

        else

        {

             System.out.println("\nINDIGO\n");

            System.out.println("\nTicket Details\n");

            System.out.println("\nName            Address      Age   Gender    Fare (Rs.) \n");

             for(i=x-c;i< x;i++)

             {

                for(int j=0;j< 100;j++)

                {

                     if(booked[j]==-1)

                     booked[j]=0;

                     break;

                    }   

       
             

                famt+=famt1;
                  System.out.println(names[i]+"            "+address[i]+"      "+age[i]+"   "+gender[i]+ "   "+famt1);

             
             

           }



             System.out.println("Total (Rs.)"+ famt);

                          System.out.println("In Words Rs:"+ numToWord(famt));

        }

          c=0;

    }

 

        void show2() throws Exception

    {

       String s;

       int famt1=0,famt=0;

       index=0;

         

        for(i=0;i<  fare2.length;i++)

        {

          s=fare2[i];

          index=s.lastIndexOf("-");

          famt1=Integer.parseInt(s.substring(index+1).trim());

          s=s.substring(0,index).trim();



                if(start2.equalsIgnoreCase(s))     

          break;

        }

   



     for(i=0;i< 100;i++)

     {

          if(booked2[i]< 0)

          index++;

        }

         if (x > index)

         {

             System.out.println("Sorry, No Ticket");

       

        }



        else

        {

             System.out.println("\nSPICEJET\n");

            System.out.println("\nTicket Details\n");

            System.out.println("\nName            Address      Age   Gender    Fare (Rs.)\n");

             for(i=x-c;i< x;i++)

             {

                for(int j=0;j< 100;j++)

                {

                     if(booked2[j]==-1)

                     booked2[j]=0;

                     break;

                    }   

                 

                famt+=famt1;

                  System.out.println(names2[i]+"            "+address2[i]+"      "+age2[i]+"   "+gender2[i]+ "   "+famt1);

           
            }

             System.out.println("Total (Rs.)"+ famt);

                          System.out.println("In Words Rs:"+ numToWord(famt));



        }

          c=0;

    }





        void show3() throws Exception

    {

       String s;

       int famt1=0,famt=0;

       index=0;         



        for(i=0;i<  fare3.length;i++)

        {

          s=fare3[i];

          index=s.lastIndexOf("-");

          famt1=Integer.parseInt(s.substring(index+1).trim());

          s=s.substring(0,index).trim();

     

          if(start3.equalsIgnoreCase(s))     

          break;

        }   



     for(i=0;i< 100;i++)

     {

          if(booked3[i]< 0)

          index++;

        }

         if (x > index)

         {

             System.out.println("Sorry, No Ticket"); 

        }

        else

        {

             System.out.println("\nAIR INDIA\n");

            System.out.println("\nTicket Details\n");

            System.out.println("\nName            Address      Age   Gender    Fare (Rs.) \n");

             for(i=x-c;i< x;i++)

             {

                for(int j=0;j< 100;j++)

                {

                     if(booked3[j]==-1)

                     booked3[j]=0;

                     break;

                    }   

                 

                famt+=famt1;

                  System.out.println(names3[i]+"            "+address3[i]+"      "+age3[i]+"   "+gender3[i]+ "   "+famt1);

             
            }

             System.out.println("Total (Rs.)"+ famt);

                          System.out.println("In Words Rs:"+ numToWord(famt));

        }

          c=0;

    }





    void show4() throws Exception

    {

       String s;

       int famt1=0,famt=0;

       index=0;       



        for(i=0;i<  fare4.length;i++)

        {

          s=fare4[i];

          index=s.lastIndexOf("-");

          famt1=Integer.parseInt(s.substring(index+1).trim());

          s=s.substring(0,index).trim();

     

          if(start4.equalsIgnoreCase(s))     

          break;

        }     



     for(i=0;i< 100;i++)

     {

          if(booked4[i]< 0)

          index++;

        }

         if (x > index)

         {

             System.out.println("Sorry, No Ticket");

            }



        else

        {

             System.out.println("\nGOAIR\n");

            System.out.println("\nTicket Details\n");

            System.out.println("\nName            Address      Age   Gender    Fare (Rs.)\n");

             for(i=x-c;i< x;i++)

             {

                for(int j=0;j< 100;j++)

                {

                     if(booked4[j]==-1)

                     booked4[j]=0;

                     break;

                    }   



                famt+=famt1;

                  System.out.println(names4[i]+"            "+address4[i]+"      "+age4[i]+"   "+gender4[i]+ "   "+famt1);

             
            }



             System.out.println("Total (Rs.)"+ famt);

            System.out.println("In Words Rs:"+ numToWord(famt));

        }

          c=0;

    }



   

    String numToWord(int n)

    {

         String str="";

         int zero=0,i,rev=0,n1;

         n1=n;



         while(true)

         {

              if(n%10==0)

              zero++;

              else

              break;



              n=n/10;

            }



            n=n1;



            for(i=n;i > 0;i=i/10)

            {

                 rev=rev*10+i%10;

                }



                while(rev > 0)

                {

                     switch(rev%10)

                     {

                         case 0:

                         str=str + " Zero";

                         break;

                     

                         case 1:

                         str=str + " One";

                         break;



                         case 2:

                         str=str + " Two";

                         break;



                         case 3:

                         str=str + " Three";

                         break;



                         case 4:

                         str=str + " Four";

                         break;



                         case 5:

                         str=str + " Five";

                         break;



                         case 6:

                         str=str + " Six";

                         break;



                         case 7:

                         str=str + " Seven";

                         break;



                         case 8:

                         str=str + " Eight";

                         break;



                         case 9:

                         str=str + " Nine";

                         break;



                        }



                        rev=rev/10;

                    }



         for(i=0;i< zero;i++)

         str=str+ " Zero";



         return str;

        }







    public static void main(String args[])throws Exception

    {

         BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));

         AirTicket ob=new AirTicket();

         char ch;



         while(true)

         {

              ob.takeData();

              System.out.println("Any More(y/n):");

              ch=(char)br1.read();

              ch=Character.toLowerCase(ch);

              if(ch=='n')

              break;

            }

        }

    }






Subscribe via email

Enter your email address:

Delivered by FeedBurner