Sunday, 2 December 2012

Number of spacesand words in the string


import java.io.*;
class Space_count{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s;
int l,i,c=0;
System.out.println("Enter the String");
s=br.readLine();
l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)==' ')
{
c++;
}
}
System.out.println("The number of spaces in the string"+c);
System.out.println("The number of words in the string"+(c+1));
}
}

To count the number of palindrome words in the string


import java.io.*;
class string46
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,k="",p="";
int i,l,c=0,c1=0,j;
    System.out.println("Enter the string : - ");
    s=br.readLine();
    s=s+" ";
    l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(j=k.length()-1;j>=0;j--)
{
p=p+k.charAt(j);
    }
if(k.equals(p)==true)
{
c1++;
}
p="";
k="";
}
}
System.out.println("The number of palindrome words in the upper string are : - "+c1);  
}
}

The each palindrome word in the string


import java.io.*;
class string41
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,k="",p="";
int i,l,c=0,c1=0,j;
    System.out.println("Enter the string : - ");
    s=br.readLine();
    s=s+" ";
    l=s.length();
System.out.println("The each palindrome word in the upper string are as follows : - ");  
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(j=k.length()-1;j>=0;j--)
{
p=p+k.charAt(j);
    }
if(k.equals(p))
{
System.out.println(k);
}
c1=0;
p="";
k="";
}
}
}
}

Saturday, 1 December 2012

To display each word in the string in reverse order


import java.io.*;
class string38
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,k="",p="";
int i,l,c=0,c1=0,j;
    System.out.println("Enter the string : - ");
    s=br.readLine();
    s=s+" ";
    l=s.length();
System.out.println("The each extracted word in reverse from are from the upper string are as follows : - ");  
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(j=k.length()-1;j>=0;j--)
{
p=p+k.charAt(j);
    }
System.out.print(p+" ");
c1=0;
p="";
k="";
}
}
}
}

to display the number of consonants in the string


import java.io.*;
class string36
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,k="";
int i,l,c=0,j,c1=0;
    System.out.println("Enter the string : - ");
    s=br.readLine();
    s=s+" ";
    l=s.length();
System.out.println("The each extracted word from the upper string The number of consonants the upper string  : - ");
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(j=0;j<k.length();j++)
{
if((k.charAt(j)=='B')||(k.charAt(j)=='b')||(k.charAt(j)=='C')||(k.charAt(j)=='c')||(k.charAt(j)=='D')||(k.charAt(j)=='d')||(k.charAt(j)=='F')||(k.charAt(j)=='f')||(k.charAt(j)=='G')||(k.charAt(j)=='g')||(k.charAt(j)=='H')||(k.charAt(j)=='h')||(k.charAt(j)=='J')||(k.charAt(j)=='j')||(k.charAt(j)=='K')||(k.charAt(j)=='k')||(k.charAt(j)=='L')||(k.charAt(j)=='l')||(k.charAt(j)=='M')||(k.charAt(j)=='m')||(k.charAt(j)=='N')||(k.charAt(j)=='n')||(k.charAt(j)=='P')||(k.charAt(j)=='p')||(k.charAt(j)=='Q')||(k.charAt(j)=='q')||(k.charAt(j)=='R')||(k.charAt(j)=='r')||(k.charAt(j)=='S')||(k.charAt(j)=='s')||(k.charAt(j)=='T')||(k.charAt(j)=='V')||(k.charAt(j)=='v')||(k.charAt(j)=='W')||(k.charAt(j)=='w')||(k.charAt(j)=='t')||(k.charAt(j)=='X')||(k.charAt(j)=='x')||(k.charAt(j)=='Y')||(k.charAt(j)=='y')||(k.charAt(j)=='Z')||(k.charAt(j)=='z'))
{
c1++;
    }
    }
System.out.println(k+"\t\t\t\t\t\t\t"+c1);
c1=0;
k="";
}
}
}
}

to dispaly each word in the string


import java.io.*;
class Word13
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,l;
String s,k="";
System.out.println("Enter your string");
s=br.readLine();
s=s+" ";
l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
System.out.println(k);
k=" ";
}
}
}
}

Display the length of each word in the string


import java.io.*;
class Word13
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,l;
String s,k="";
System.out.println("Enter your string");
s=br.readLine();
s=s+" ";
l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
System.out.println(k+"\t\t\t\t\t\t\t"+k.length());
k=" ";
}
}
}
}

Dispay of each word with the no. of vowels in it


import java.io.*;
class Word2
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,c=0,l;
String s,k="";
System.out.println("Enter the string");
s=br.readLine();
s=s+" ";
l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(int j=0;j<k.length();j++)
{
if((k.charAt(j)=='A')||(k.charAt(j)=='a')||(k.charAt(j)=='E')||(k.charAt(j)=='e')||(k.charAt(j)=='I')||(k.charAt(j)=='i')||(k.charAt(j)=='O')||(k.charAt(j)=='o')||(k.charAt(j)=='U')||(k.charAt(j)=='u'))
{
c++;
}
}
System.out.println(k+"\t\t\t\t\t\t\t"+c);
c=0;
k="";
}
}
}
}

Palindrome_string


import java.io.*;
class Palindrome
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,l;
String s,k="";
System.out.println("Enter the string");
s=br.readLine();
l=s.length();
for(i=l-1;i>=0;i--)
{
k=k+s.charAt(i);
}
if(s.compareTo(k)==0)
{
System.out.println("The string is palindrome");
}
else
{
System.out.println("The string is not palindrome");
}
}
}

TIPS --TO--BE ---A--GOOD--TYPIST


TIPS ------TO-------BE -------A--------GOOD-----------TYPIST

1:TRY TO AVOID YOUR MOUSE AS MUCH AS POSSIBLE.

2:TYPE EVERYDAY.

3.USE End TO REACH THE END OF THE LINE.

4.USE Home TO REACH THE STARTING OF THE LINE.

5.USE SHIFT INSTEAD OF CAPSLOCK.

6.ALWAYS KEEP BOTH YOUR HANDS ON YOUR KEYBOARD

7.USE THESE SHORTCUT KEYS FOR BLUE J::

a.CTRL+C----TO COPY
b.CTRL+V----TO PASTE
c.CTRL+A-----TO SELECT ALL
d..CTRL+S-----TO SAVE
e.CTRL+F------TO FIND AND REPLACE
f.CTRL+K------TO COMPILE
G.CTRL+SHIFT+R----TO RESET MACHINE

8.PRACTICE CERTAIN FREE TYPING GAMES AVAILABLE ON INTERNET

9.USE  F6 FOR  INDENTATION

10.TRY AVOID USING NUMLOCK KEYS WHICH LITERALLY KILLS YOUR TYPING SPEED.




WEAKARM NUMBER


import java.io.*;
class weakarm
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n,m,c=0,i;
double s=0,d;
System.out.println("Enter the number to check wheather the number is armstrong or not  : -  ");
n=Integer.parseInt(br.readLine());
m=n;
while(m>0)
{
c++;
m=m/10;
    }
    m=n;
while(m>0)
{
d=m%10;
s=s+Math.pow(d,c);
m=m/10;
c--;
    }
        if(n==(int)(s))
    {
System.out.println(n+" is an weakarm number ");
    }
    else
{
System.out.println(n+" is not an weakarm number ");
    }  
    }
}

FIBONACCI NUMBER


import java.io.*;
class fibonacci
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n,a,b,c;
System.out.println("Enter the range ");
n=Integer.parseInt(br.readLine());
a=0;
b=1;
c=0;
System.out.println("The fibonacci series upto "+n+" are");
while(c<=n)
{
System.out.println(a);
c=a+b;
b=a;
a=c;
    }
    }
}

ARMSTRONG NUMBER


import java.io.*;
class armstrong1
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n,m,c=0,i;
double s=0,d;
System.out.println("Enter the number to check wheather the number is armstrong or not  : -  ");
n=Integer.parseInt(br.readLine());
m=n;
while(m>0)
{
c++;
m=m/10;
    }
   
for(m=n;m>0;m=m/10)
{
d=m%10;
s=s+Math.pow(d,c);
    }
        if(n==(int)(s))
    {
System.out.println(n+" is an armstrong number ");
    }
    else
{
System.out.println(n+" is not an armstrong number ");
    }  
    }
}

CASE CHANGE WITHOUT USING FUNCTIONS


package Strings_ICSE;
import java.io.*;
class Alter_case
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String s,p="";
System.out.println("Eneter the string");
s=br.readLine();
int l=s.length();
int k=0;
for(int i=0;i<l;i++)
{
k=(int)(s.charAt(i));
if((k>=65) && (k<=90))
{
k=k+32;
}
else if((k>=97) && (k<=122))
{
k=k-32;
}
p=p+(char)(k);
}
System.out.println("The string in changed case is ="+p);
}
}



ICSE2012_SORTING OF STRING


import java.io.*;
class string_sort1
    {
        public static void main(String args[])throws IOException
        {
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 int n,i,j,k=0;
 String t;
 System.out.println("Enter the range : - ");
 n=Integer.parseInt(br.readLine());
String a[]=new String[n];
 System.out.println("Enter the name : - ");
 for(i=0;i<n;i++)
 {
     a[i]=br.readLine();
     a[i]=a[i].toUpperCase();
    }
    System.out.println("The name are as follows : - ");
 for(i=0;i<n;i++)
 {
 System.out.println(a[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
 while((int)(a[i].charAt(k))==(int)(a[j].charAt(k)))
 {
     k++;
    }
    if((int)(a[i].charAt(k))<(int)(a[j].charAt(k)))
    {
        t=a[i];
        a[i]=a[j];
        a[j]=t;
    }
    k=0;
        }
    }
 System.out.println("The name after sorting are as follows : - ");
 for(i=0;i<n;i++)
 {
 System.out.println(a[i]);
    }  
        }
    }

RESTAURANT_PIZZA HUT 2012


import java.lang.*;
import java.io.*;
class project
{
    public static void main(String[]args)throws IOException
    {
    int F=0,ac;
    int h;
    String ab;
    do
    {
    System.out.println("           ***WELCOME TO THE PIZZA HUT***");
    System.out.println("           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    System.out.println();
    System.out.println("           PAN & STUFFED CRUST MENU");
    System.out.println("         **************************");
    System.out.println();
    String it[]=new String[50];
    int ct[]=new int[50];
    System.out.println("SPECIAL OFFER");
    System.out.println("-------------");
    System.out.println("1 spicy veggie, 1 veggie delight, 1 veggie crunch worth Rs.200");
    System.out.println("Pay Rs. 25 more and get 4 flavours of creambell icecream");
    System.out.println();
    System.out.println();
    System.out.println("Vegetarian      Persnal     Medium      Large");
    System.out.println();
    System.out.println("Simply Veg      Rs.50       Rs.95       Rs.195");
    System.out.println("Veggie Crunch   Rs.50       Rs.95       Rs.195");
    System.out.println("Cheezy Cheeze   Rs.70       Rs.130      Rs.230");
    System.out.println("Veggie Lovers   Rs.70       Rs.130      Rs.230");
    System.out.println("Spicy Indian    Rs.70       Rs.130      Rs.230");
    System.out.println("Country Feast   Rs.95       Rs.185      Rs.285");
    System.out.println("Spicy Paneer    Rs.95       Rs.185      Rs.285");
    System.out.println("Veggie Supreme  Rs.95       Rs.185      RS.285");
    System.out.println("Exotica         Rs.95       Rs.185      Rs.285");
    System.out.println("Veggie Tama-Tam Rs.70       Rs.130      Rs.230");
    System.out.println("Paneer Punjabi  Rs.95       Rs.185      Rs.280");
    System.out.println();
    System.out.println("```Non Veg```   Personal    Medium      Large");
    System.out.println();
    System.out.println("Teekha Chicken  Rs.70       Rs.130     Rs.230");
    System.out.println("Chicken Tikkia  Rs.90       Rs.175     Rs.275");
    System.out.println("Chick 'n'Spicy  Rs.90       Rs.175     Rs.275");
    System.out.println("Chicken Supreme Rs.110      Rs.195     Rs.295");
    System.out.println("Pepperoni       Rs.110      Rs.195     Rs.295");
    System.out.println("Supreme         Rs.110      Rs.195     Rs.295");
    System.out.println("Murg Mazedar    Rs.90       Rs.175     Rs.275");
    System.out.println("Supreme TandooriRs.110      Rs.195     Rs.295");
    System.out.println();
    System.out.println();
    System.out.println("Beverages");
    System.out.println("Pepsi,Diet Pepsi(500ml bottle)");
    System.out.println("Miranda,7UP(can)");
    System.out.println("Beverages to be sold on M.R.P");
    System.out.println();
    BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
    System.out.println();
    System.out.println("Enter your name plz");
    String nam=buf.readLine();
    System.out.println();
    System.out.println();
    int i=0,S=0;
    do
    {
    System.out.println("Enter item name");
    String x=buf.readLine();
    it[i]=x;
    if(x.equalsIgnoreCase("Simply veg")==true);
    {
    F=1;
    System.out.println("enter 1 for personsl");
    System.out.println("enter 2 for medium");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=50;
        S=S+50;
        break;
    case 2: ct[i]=95;
        S=S+95;
        break;
    case 3: ct[i]=195;
        S=S+195;
        break;
        default: System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Vegie Crunch")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for personal");
    System.out.println();
    String c=buf.readLine();
     int ch=Integer.parseInt(c);
     switch(ch)
     {
     case 1: ct[i]=50;
        S=S+50;
        break;
     case 2: ct[i]=95;
        S=S+95;
        break;
     case 3: ct[i]=195;
        S=S+195;
        break;
     default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Cheezy Cheeze")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=70;
        S=S+70;
        break;
    case 2: ct[i]=130;
        S=S+130;
        break;
    case 3: ct[i]=230;
        S=S+230;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Veggie Lovers")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=70;
        S=S+70;
        break;
    case 2: ct[i]=130;
        S=S+130;
        break;
    case 3: ct[i]=230;
        S=S+230;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("SPECIAL OFFER")==true)
{
    F=1;
    S=S+200;
    ct[i]=200;
    }
    if(x.equalsIgnoreCase("Spicy Indian")==true)
    {
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=70;
        S=S+70;
        break;
    case 2: ct[i]=130;
        S=S+130;
        break;
    case 3: ct[i]=230;
        S=S+230;
        break;
    default: System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Country Feast")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=185;
        S=S+185;
        break;
    case 3: ct[i]=285;
        S=S+285;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Spicy Paneer")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=185;
        S=S+185;
        break;
    case 3: ct[i]=285;
        S=S+285;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Veggie Supreme")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=95;
        S=S+95;
        break;
    case 2: ct[i]=185;
        S=S+185;
        break;
    case 3: ct[i]=285;
        S=S+285;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Exotica")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
    String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=110;
        S=S+110;
        break;
    case 2: ct[i]=195;
        S=S+195;
        break;
    case 3: ct[i]=295;
        S=S+295;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Veggie Tamma-Tam")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=70;
        S=S+50;
        break;
    case 2: ct[i]=130;
        S=S+50;
        break;
    case 3: ct[i]=285;
        S=S+230;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Panner Panjabi")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=95;
        S=S+95;
        break;
    case 2: ct[i]=185;
        S=S+185;
        break;
    case 3: ct[i]=280;
        S=S+280;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Teekha Chicken")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=70;
        S=S+70;
        break;
    case 2: ct[i]=130;
        S=S+130;
        break;
    case 3: ct[i]=230;
        S=S+230;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Chicken Tikia")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=175;
        S=S+175;
        break;
    case 3: ct[i]=275;
        S=S+275;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Chick'n' Spicy")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=175;
        S=S+175;
        break;
    case 3: ct[i]=275;
        S=S+275;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Chicken Supreme")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=100;
        S=S+110;
        break;
    case 2: ct[i]=195;
        S=S+195;
        break;
    case 3: ct[i]=295;
        S=S+295;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Pepperoni")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=110;
        S=S+110;
        break;
    case 2: ct[i]=195;
        S=S+185;
        break;
    case 3: ct[i]=295;
        S=S+295;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Supreme")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=185;
        S=S+185;
        break;
    case 3: ct[i]=285;
        S=S+285;
    break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Supreme")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=110;
        S=S+110;
        break;
    case 2: ct[i]=195;
        S=S+195;
        break;
    case 3: ct[i]=295;
        S=S+295;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Murg Mazedar")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=175;
        S=S+175;
        break;
    case 3: ct[i]=275;
        S=S+275;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Supreme Tandoori")==true)
{
    F=1;
    System.out.println("enter 1 for personal");
    System.out.println("enter 2 for personal");
    System.out.println("enter 3 for large");
    System.out.println();
String c=buf.readLine();
    int ch=Integer.parseInt(c);
    switch(ch)
    {
    case 1: ct[i]=90;
        S=S+90;
        break;
    case 2: ct[i]=175;
        S=S+175;
        break;
    case 3: ct[i]=275;
        S=S+275;
        break;
    default:System.out.println("wrong choice");
    }
}
if(x.equalsIgnoreCase("Pepsi")==true)
{
    F=1;
    S=S+20;
    ct[i]=20;
}
if(x.equalsIgnoreCase("Diet Pepsi")==true)
{
    F=1;
    S=S+20;
    ct[i]=20;
}
if(x.equalsIgnoreCase("Miranda")==true)
{
    F=1;
    S=S+25;
    ct[i]=25;
}
if(x.equalsIgnoreCase("7UP")==true)
{
    F=1;
    S=S+25;
    ct[i]=25;
}
if(F==0)
{
    System.out.println("Please check the spelling of Item Or the item is not Available.");
    System.out.println("*******     SORRY       ! **********");
    }
    System.out.println("if you want more enter 1 or enter 2");
    String y=buf.readLine();
    h=Integer.parseInt(y);
    i++;
    } while(h==1);
    System.out.println();
    System.out.println("_________  BILL  ___________");
    System.out.println("        ***************     ");
    System.out.println();
    System.out.println("    "+nam);
    System.out.println("    ~~~~~~");
    for(int g=0;g<=i-1;g++)
    {
    System.out.println();
    System.out.println(it[g]+"__________>"+ct[g]);
    }
    System.out.println("Total price="+"___________>"+S);
    System.out.println();
    double q=5.0/100*S;
    System.out.println("Sales tax 5%"+"___________>"+q);
    System.out.println();
    double w=S+q;
    System.out.println("Total Amount _____________>"+w);
    System.out.println();
    double r=10.0/100*w;
    System.out.println("Discount 10%"+"___________>"+r);
    System.out.println();
    double t=w-r;
    System.out.println("Net Amount _______________>"+t);
    System.out.println();
    System.out.println();
    System.out.println();
    System.out.println("Is there any more customer");
    System.out.println("If yes enter 2, if no enter 1");
    ab=buf.readLine();
    ac=Integer.parseInt(ab);
    }
    while(ac==2);
    System.out.println("         THANKS FOR YOUR VISIT");
    System.out.println("         ~~~~~~~~~~~~~~~~~~~~~~~~~~");
    System.out.println();
    System.out.println("         HOPE YOU ENJOYED THE SERVICE");
    System.out.println("       **************************************");
    System.out.println();
    System.out.println(                                                       "WAITING FOR YOUR NEXT VISIT");
    System.out.println();
    System.out.println("        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
    System.out.println();
    }
}

QUIZ OF ANSHU


import java .io.*;
class ANIMAL_KINGDOM
{
public void   main()throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int count=0;int i=0;// Initialising the variables//
System.out.println("ENTER THE NUMBER OF YOUR OPTION");
System.out.println("1. PISCES");
System.out.println("2. AMPHIBIAN");
System.out.println("3. REPTILIA");
System.out.println("4. AVES");
System.out.println("5. MAMMALIA");
System.out.println("6. QUESTION");
System.out.println("7. EXIT");
i= Integer.parseInt(br.readLine());// To accept the entered choice/
switch(i)

{
case 1:
System.out.println("                                                    PISCES");
System.out.println("*Pisces includes all fishes. They are completely adapted to aquatic life.Their body is completely covered with scales.");
System.out.println("*They have a two-chambered heart,breathe by means of gills and are cold blooded(poikilothermal) ");
System.out.println("*They have fins but no limbs.They are two main types-");
System.out.println("*(a)Cartilagenous fishes, Examples-Sharks,dogfish,skates.");
System.out.println("*(b)Bony fishes, Examples-Carps,Roaches,Herrings.");
break;
case 2:
System.out.println("                                                  AMPHIBIA");
System.out.println("*Amphibians live partly on land and partly in water.In early stages of life they breathe by means of gills but their adults breathe by means of lungs.");
System.out.println("*They have a smooth,non scaly moist,slimy skin.The eardrum (Typanum)lies on the surface of the skin.");
 System.out.println ("*They have five fingered(pentadactyl)limbs and a three-chambered heart.They are cold blooded.");
System.out.println("*Examples-Frog,Toad,Salamander.");
break;
case 3:
System.out.println("                                                REPTILIA");
System.out.println ("*Reptiles are completely adapted to life in land.Their eggs have a leathery shell.They breathe by means of lungs right from birth.");
System.out.println ("*They have rough, horny scales on the skin and a three-chambered heart in which the ventricle is partially divided.");
System.out.println("*The eardrum (Typanum)lies at the bottom of a tubular depression and are cold blooded.");
System.out.println("*Examples-Lizard,Snaker,Tortoise");
break;
case 4:
System.out.println("                                                  AVES");
System.out.println (" *Aves breathe by means of lungs .They have an exoskelton of feathers.");
System.out.println (" *Their fore-limbs are modified into wings.They have scaly legs and a four-chambered heart.");
System.out.println (" *Their body is streamlined and the skelton is light to facilitate flying.");
System.out.println (" *Examples-Pigeon,Sparrow,Crow");
break;
case 5:
System.out.println("                                                 MAMMALIA");
System.out.println(" *Mammals  are the most highly developed animals for life on land, although some of them such as whales live in water and bats fly in air.  ");
System.out.println(" *They give birth to living young ones.They suckle their young ones byn means of mammary glands.They have hair on their skin and are warm-blooded.");
System.out.println(" *They have muscular diaphragm seperating the thorax and abdomen internally.They have four-chambered heart and breathe by means of lungs.");
System.out.println(" *Examples-Bat,Monkey,Man ");
break;
case 6:

System.out.println("(A)Which Class has Pentadactyl Limbs and has Smooth  and Slimy skin ?");
System.out.println("1.REPTILIA");
System.out.println("2.AMPHIBIA");
System.out.println("3.AVES");
int i1= Integer.parseInt(br.readLine());
if(i1==2)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS AMPHIBIA ");
System.out.println("(B)State the numbers of chambers of the heart of a salamander ?");
System.out.println("1.3-CHAMBERED");
System.out.println("2.2-CHAMBERED");
System.out.println("3.NONE OF THE ABOVE");
int i2= Integer.parseInt(br.readLine());
if(i2==1)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS 3-CHAMBERED");
System.out.println("(C)Aves have an exoskeleton made of ?");
System.out.println("1.CHITIN");
System.out.println("2.FEATHERS");
System.out.println("3.SPONGIN FIBRES");
int i3= Integer.parseInt(br.readLine());
if(i3==2)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS FEATHERS");
System.out.println("(D)In which class of vertebrates does the tympanum lie at the bottom of a tubular depression ?");
System.out.println("1.REPTILIA");
System.out.println("2.MAMMLIA");
System.out.println("3.PISCES");

int i4= Integer.parseInt(br.readLine());
if(i4==1)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS REPTILIA");
System.out.println("(E)  Herrings are example of ?");
System.out.println("1.BONY FISH");
System.out.println("2.NONE OF THE ABOVE");
System.out.println("3.CARTILAGENOUS FISH");
int i5= Integer.parseInt(br.readLine());
if(i5==1)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS BONY FISH");  
System.out.println("(F)  Reptiles are completely adapted to life ?");
System.out.println("1.ON LAND");
System.out.println("2.IN WATER");
System.out.println("3.IN BOTH LAND AND WATER");
int i6= Integer.parseInt(br.readLine());
if(i6==1)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS ON LAND");
System.out.println("(G)  Which class of vertebrate lay their eggs with a calcareous shell ?");
System.out.println("1.REPTILIA");
System.out.println("2.PISCES");
System.out.println("3.AVES");
int i7= Integer.parseInt(br.readLine());
if(i7==3)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS AVES");
System.out.println("(H)  Bats are example of?");
System.out.println("1.AVES");
System.out.println("2.REPTILIA");
System.out.println("3.MAMMALIA");
int i8= Integer.parseInt(br.readLine());
if(i==3)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS MAMMALIA");
System.out.println("(I)  They have diaphragm seperating the thorax and abdomen,breathe by means of lungs?");
System.out.println("1.REPTILIA");
System.out.println("2.AVES");
System.out.println("3.MAMMALIA");
int i9= Integer.parseInt(br.readLine());
if(i9==3)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS MAMMALIA");
System.out.println("(J)  Which class 'breathes by means of gills throughout their life and are poikilothermal'?");
System.out.println("1.MAMMALIA");
System.out.println("2.AMPHIBIA");
System.out.println("3.PISCES");
int i10= Integer.parseInt(br.readLine());
if(i10==3)
{
System.out.println("CORRECT ANSWER");
count=count+2;
    }
else
System.out.println("WRONG ANSWER .THE CORRECT ANSWER IS AVES ");
System.out.println("YOUR TOTAL SCORE IS "+count);
if(count>=18)
System.out.println("YOUR RESULT IS EXCELLENT");
if(count>=16&&count<18)
System.out.println("YOUR RESULT IS VREY GOOD");
if(count>=12&&count<16)
System.out.println("YOUR RESULT IS GOOD");
if(count>=8&&count<12)
System.out.println("YOUR RESULT IS SATISFACTORY");
if(count<8)
System.out.println("TRY HARDER");
break;
case 7:
System.out.println("THANK YOU FOR VISITING OUR SITE");
default :
System.out.println("YOU HAVE ENTERED A WRONG CHOICE");
}

    }
   }
 

KAUN BANEGA CROREPATI



import java.io.*;//package included to display KBC
import java.util.Random;
class KBC//class name
{
 static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));//input statement
 static Random r=new Random();//input statement
 static int stage,amount,life,aud=0,phn=0,expt=0,ddip=0,ddip1=0,correct,in,fin,c;//variable assigned to integer
 static String s1,opt;//variable assigned to string
 static int a[]={5000,10000,20000,40000,80000,160000,320000,640000,1250000,2500000,5000000,10000000,50000000};/*storage of
 amount into array*/;
 static String s[]={"1 : Audience poll","2 : Phone a friend","3 : Expert Advice","4 : Double dip"};/*lifelines stored in
 string*/;
 static void main()throws IOException
 {
     display();//will call the method display
     database();//will call the method database
    }
    static void display()throws IOException
    {
        int i,j;//variables assigned
        System.out.print("\fWelcome to Kaun Banega Crorepati (Computerized version 1.0)");
        System.out.print("\n\nThis version is similar to original game");
        System.out.print("\nYou'll have to answer 13 questions to win 5 crore ruppees\n");
        for(i=1;i<=13;i++)//loop runs 13 times since there are 13 cash amounts
        {
            System.out.print("\n"+i+" <> Rs. "+a[i-1]);//a[i-1] includes the cash amount stored in array
                    }
        System.out.print("\n");
        stageset();
        System.out.print("\fIn addition to this, you'll have 4 lifelines to assist you\n\n");
        System.out.print(s[0]+" : Will help you to take audience's opinion\n");
        System.out.print(s[1]+" : Will enable you to call your friend for the answer\n");
        System.out.print(s[2]+" : Ask the experts for their advice\n");
        System.out.print(s[3]+" : Will allow you to give two answers for the same question\n");
        System.out.print("\nWarning : If you use double dip, you'll not be able to quit the game or use another lifeline");
        controls();//calls from the method controls
    }
    static void stageset()throws IOException
    {
        String c;
        System.out.print("\nPlease set a stage (Enter question number) : ");
        stage=Integer.parseInt(br.readLine());
        if(stage>=1 && stage<=13)
        {
            System.out.print("\nYou have selected : "+stage+" <> Rs. "+a[stage-1]);
            System.out.print("\n\nAre you sure (Y/N) : ");
            c=br.readLine();
            if(!(c.substring(0).equalsIgnoreCase("Y")))
            stageset();
        }
        else
        {
            System.out.print("\nInvalid input. Please enter again.\n");
            stageset();
        }
    }
    static void controls()throws IOException
    {
        System.out.print("\n\nEnter choices as A B C D");
        System.out.print("\nEnter 'L' to choose a life-line");
        System.out.print("\nEnter 'Q' to quit");
        System.out.print("\n\nEnter any key to clear screen and continue : ");
        s1=br.readLine();
        System.out.print("\f");
    }
    static void play()throws IOException
    {
        System.out.print("\n\nEnter your choice : ");//to enter the choice
        opt=br.readLine();
        if(opt.substring(0,1).equalsIgnoreCase("A"))
        c=1;
        if(opt.substring(0,1).equalsIgnoreCase("B"))
        c=2;
        if(opt.substring(0,1).equalsIgnoreCase("C"))
        c=3;
        if(opt.substring(0,1).equalsIgnoreCase("D"))
        c=4;
        if(opt.substring(0,1).equalsIgnoreCase("L"))
        {
            lifeline();
            if(ddip1==0)
            play();
            ddip1=0;
        }
        if(opt.substring(0,1).equalsIgnoreCase("Q"))
        quit();
    }
    static void lifeline()throws IOException
    {
        int i;
        System.out.print("\nYou have the following lifelines left : ");
        for(i=0;i<=3;i++)
        System.out.print(s[i]+"  ");
        System.out.print("\n\nWhich one would you like to use (Enter number) : ");
        life=Integer.parseInt(br.readLine());//to choose lifelines
        switch(life)//switch statement
        {
            case 1://first case for audience poll
            audience();
            break;
            case 2://second case for phone a friend
            phone();
            break;
            case 3://third case for experts advice
            expert();
            break;
            case 4://fourth case for double dip
            dip();
            break;
            default:
            System.out.print("\nThis life line is not available");
        }
    }
    static void database()throws IOException
    {
        int cont=1;
        System.out.print("Stage : "+cont+" <> "+a[0]+"\n\n");//Here comes the QUESTIONS
        System.out.print("If bat is related to cricket, then racket is related to : ");
        System.out.print("\n\nA: Kabbadi\t\tB: Badminton\nC: Football\t\tD: High Jump");
        correct=2;
        play();
        if(correct==c)
        {
            in=a[0];
            System.out.print("\nWell done. Correct answer.");
            if(stage==1)//stage is selected by the user
            {
                fin=in;//cash is being stored in the the variable fin
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is B: Badminton");
            end();//calls the method end
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[1]+"\n\n");
        System.out.print("Where is Fort William located ? : ");
        System.out.print("\n\nA: Chennai\t\tB: Delhi\nC: Kolkata\t\tD: Mumbai");
        correct=3;
        play();
        if(correct==c)
        {
            in=a[1];
            System.out.print("\nWell done. Correct answer.");
            if(stage==2)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is C: Kolkata");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[2]+"\n\n");
        System.out.print("What 'Guru-Dakshina' did Drona ask from Ekalavya? : ");
        System.out.print("\n\nA:  His right index finger\t\tB: Wealth\nC:  A quiver full of arrows\t\tD: His right thumb");
        correct=4;
        play();
        if(correct==c)
        {
            in=a[2];
            System.out.print("\nWell done. Correct answer.");
            if(stage==3)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is D: His right thumb");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[3]+"\n\n");
        System.out.print("What is the full form of the 'APJ' in Dr. Kalam's name? : ");
        System.out.print("\n\nA: Ahmed Panthwawala Jain\t\tB: Avul Pakir Jainulabdeen\nC: Ali Ponnuswamy Jampiru\t\tD: Akbar Panneer Jalant");
        correct=2;
        play();
        if(correct==c)
        {
            in=a[3];
            System.out.print("\nWell done. Correct answer.");
            if(stage==4)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is B: Avul Pakir Jainulabdeen");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[4]+"\n\n");
        System.out.print("Who is the first woman head of state to fly in a fighter jet : ");
        System.out.print("\n\nA: Smt. Pratibha Devisingh Patil\t\tB: Isabel Martínez de Perón\nC: Mary McAleese\t\tD: Valeria Ciavatta");
        correct=1;
        play();
        if(correct==c)
        {
            in=a[4];
            System.out.print("\nWell done. Correct answer.");
            if(stage==5)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is A: Smt. Pratibha Devisingh Patil");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[5]+"\n\n");
        System.out.print("Who owns the fast food joints KFC and Pizza Hut ? : ");
        System.out.print("\n\nA: McFood\t\tB: Yum! Restaurants\nC: DesPlaines Illinois\t\tD: Richard and Maurice");
        correct=2;
        play();
        if(correct==c)
        {
            in=a[5];
            System.out.print("\nWell done. Correct answer.");
            if(stage==6)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is B: Yum! Restaurants");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[6]+"\n\n");
        System.out.print("Where was the first oil well struck in the world? : ");
        System.out.print("\n\nA: Kuwait\t\tB: USA\nC: Saudi Arabia\t\tD: Australia");
        correct=2;
        play();
        if(correct==c)
        {
            in=a[6];
            System.out.print("\nWell done. Correct answer.");
            if(stage==7)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is B: USA");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[7]+"\n\n");
        System.out.print("Located in India it is Asia's largest residential university. Name it...? : ");
        System.out.print("\n\nA: Banaras Hindu University\t\tB: The Utkal University\nC: Jawaharlal Nehru University\t\tD: Anna University");
        correct=1;
        play();
        if(correct==c)
        {
            in=a[7];
            System.out.print("\nWell done. Correct answer.");
            if(stage==8)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is A: Banaras Hindu University");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[8]+"\n\n");
        System.out.print("Who among the following is NOT associated with billiards in India? : ");
        System.out.print("\n\nA: Subash Agrawal\t\tB: Ashok Shandilya\nC: Manoj Kothari\t\tD: Mihir Sen");
        correct=4;
        play();
        if(correct==c)
        {
            in=a[8];
            System.out.print("\nWell done. Correct answer.");
            if(stage==9)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is D: Mihir Sen");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[9]+"\n\n");
        System.out.print("Who among the following was NOT the Chief Minister of Madras state or the Tamil Nadu? : ");
        System.out.print("\n\nA: C.Rajagopalachari\t\tB: C.Annadurai\nC: M.G.Ramachandran\t\tD: Poti Sriramulu");
        correct=4;
        play();
        if(correct==c)
        {
            in=a[9];
            System.out.print("\nWell done. Correct answer.");
            if(stage==10)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is D: Poti Sriramulu");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[10]+"\n\n");
        System.out.print("Who wrote the Novel 'Pather Dabi' in Bengali? : ");
        System.out.print("\n\nA: Kazi Nazrul Islam\t\tB: Bankim Chandra\nC: Saratchandra Chattopadhay\t\tD: Rabindranath Tagore");
        correct=3;
        play();
        if(correct==c)
        {
            in=a[10];
            System.out.print("\nWell done. Correct answer.");
            if(stage==11)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is C: Saratchandra Chattopadhay");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[11]+"\n\n");
        System.out.print("Which of the following is a popular form of Buddhism in Japan? : ");
        System.out.print("\n\nA: Zen\t\tB: Pikachu\nC: Totoro\t\tD: Matsushita");
        correct=1;
        play();
        if(correct==c)
        {
            in=a[11];
            System.out.print("\nWell done. Correct answer.");
            if(stage==12)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is A: Zen");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\fStage : "+cont+" <> "+a[12]+"\n\n");
        System.out.print("What was the capital of Panchala? : ");
        System.out.print("\n\nA: Dwaraka\t\tB: Matsya\nC: Kamapilya\t\tD: Magadha");
        correct=3;
        play();
        if(correct==c)
        {
            in=a[12];
            System.out.print("\nWell done. Correct answer.");
            if(stage==13)
            {
                fin=in;
                System.out.print("\n\nCongratulations, you have completed your desired stage succesfully");
            }
        }
        else
        {
            System.out.print("\nSorry, but this is the wrong answer");
            System.out.print("\n\nCorrect answer is C: Kamapilya");
            end();
        }
        System.out.print("\n\nEnter any key to continue : ");
        s1=br.readLine();
        cont++;
        System.out.print("\f");
        for(int i=1;i<=3;i++)
        {
            System.out.print("Many ");
        }
        System.out.print("Congratulations to you.\n\nYou have completed this challenge");
        quit();
    }
    static void audience()throws IOException
    {
        aud++;
        int a[]=new int[3];// three numbers are stored in an array
        int s1=0,i,j,c;
        s[0]="";
        for(i=0;i<=2;i++)
        {
            c=r.nextInt(15);//randomly any three numbers are selected
            a[i]=c;
        }
        s1=100-(a[0]+a[1]+a[2]);//s1 is equal to difference between 100 and the sum of the 3 numbers selected randomly
        System.out.print("\nAwaiting reply ");
        for(i=1;i<=3;i++)
        {
            System.out.print(".");
                   }
        System.out.print("\n\n");
        if(correct==1)
        {
            System.out.print("\nA : "+s1+" %");
            System.out.print("\nB : "+a[0]+" %");
            System.out.print("\nC : "+a[1]+" %");
            System.out.print("\nD : "+a[2]+" %");
        }
        if(correct==2)
        {
            System.out.print("\nA : "+a[0]+" %");
            System.out.print("\nB : "+s1+" %");
            System.out.print("\nC : "+a[1]+" %");
            System.out.print("\nD : "+a[2]+" %");
        }
        if(correct==3)
        {
            System.out.print("\nA : "+a[1]+" %");
            System.out.print("\nB : "+a[0]+" %");
            System.out.print("\nC : "+s1+" %");
            System.out.print("\nD : "+a[2]+" %");
        }
        if(correct==4)
        {
            System.out.print("\nA : "+a[2]+" %");
            System.out.print("\nB : "+a[0]+" %");
            System.out.print("\nC : "+a[1]+" %");
            System.out.print("\nD : "+s1+" %");
        }
    }
    static void phone()
    {
        phn++;
        int c=r.nextInt(5);//any 5 numbers are selected randomly to c
        System.out.print("\n");
        s[1]="";
        if(c==1 || c==3 || c==5 || c==4)
        {
            if(correct==1)
            System.out.print("Friend says its 'A'");
            if(correct==2)
            System.out.print("Friend says its 'B'");    
            if(correct==3)
            System.out.print("Friend says its 'C'");
            if(correct==4)
            System.out.print("Friend says its 'D'");
        }
        else
        System.out.print("Friend has no idea");
    }
    static void expert()
    {
        expt++;
        int c=r.nextInt(5);//any 5 numbers are selected randomly to c
        System.out.print("\n");
        s[2]="";
        if(c==1 || c==3 || c==5 || c==4)
        {
            if(correct==1)
            System.out.print("Expert thinks it to be 'A'");
            if(correct==2)
            System.out.print("Expert thinks it to be 'B'");    
            if(correct==3)
            System.out.print("Expert thinks it to be 'C'");
            if(correct==4)
            System.out.print("Expert thinks it to be 'D'");
        }
        else
        System.out.print("Expert has no idea");
    }
    static void dip()throws IOException
    {
        s[3]="";
        ddip1=1;//initialization of ddip1
        ddip++;
        System.out.print("\nFirst choice : ");
        play();
        if(correct==c)
        {
           System.out.print("\nCorrect answer");
        }
        else
        {
            System.out.print("\nWrong answer\n\nSecond choice : ");
            play();
        }
    }
    static void quit()
    {
        fin=in;//display the original amount
        end();
    }
    static void end()
    {
        System.out.print("\n\nYou have won Rs. "+fin);
        System.out.print("\n\nThank you for participating in KBC version 1.0");
        System.out.print("\n\nWish you all the best\nTake care\nSee you again.");
        System.exit(0);
    }
}