Skip to main content

An Example of Java Main Project for ICSE Class 10

//AUTHOR OF THE PROJECT: Mrunal.N.C
import java.io.*;   //Importing java.io packageimport java.util.*; //Importing java.util package import java.net.*;  //Importing java.net packageimport java.awt.*;  //Importing java.awt packageimport java.nio.*;  //Importing java.nio packageimport java.math.*; //Importing java.math package
public class Bill
{
 String item[]={" Full Meals    "," Dum Aloo      "," Dosa          "," Naan          "," Palak Paneer  "," Dal           "," Mini Meals    "," Samosa        "," Fried Rice    ","Chana Masala  "};    //Variable to store food items         double rate[]={200,75,35,45,75,55,155,20,40,65};  //Variable to store cost of food items String order[]=new String[10];   //Creating an Array of Base Type String and of length 10 double amt[]=new double[10];   //Creating an Array of Base Type double and of length 10 String ans;                      // Variable to store answer that is, any more items are required by the user or not char ch;                   // Variable to store the answer whether the applicarion has to be continued or not int plates[]=new int[10];        //Creating an Array of Base Type int and of length 10 int i,n=0,no,x=0; static Bill object =new Bill();   //Creating an object of Bill type
 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
 Bill()   //A default Constructor {    } 
 public void putOrder()throws Exception   //A function putOrder returning no value(void return type)with a public access specifier   {     System.out.println(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");     System.out.println("                                     Four Seasons Hotel                                      ");     System.out.println("                                         Menu Card                                          ");   //Displaying the MENU     System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");     System.out.println("  Item No.                            Item                                        Rate/plate");    for(i=0;i< 10;i++){         System.out.println("  "+(i+1)+ ":                                 "+item[i]+"                               "+rate[i]);     }
for(int i=1;i<=1;i++){
System.out.println("   \n   Enter item number from 1 to 10 to place order\n");
}x=0;       while(true){if(x==10)break;
         Scanner sc=new Scanner(System.in);         System.out.print("   Please enter the item number :");         no=sc.nextInt();                 order[x]=item[no-1];         amt[x]=rate[no-1];                System.out.print("   Please Enter the number of plates :");         no=Integer.parseInt(br.readLine());         plates[x]=no;         x++;                 if(x>0)         {                         System.out.print("   Any More Item ?(Y/N):");             ans=br.readLine().toUpperCase();             if(ans.equals("N"))             break;                      }         }               showBill();                }         //putOrder function ends here        private void showBill() throws Exception{
double bamt=0,b;
System.out.println("\f");System.out.println("   You have ordered\n");System.out.println("   Item                                                     Rate                        No. of Plates");
  for(i=0;i< x;i++)  {            System.out.println("   "+(i+1)+":"+order[i]+"                                        "+amt[i]+"                              "+plates[i]);        }     while(true)      {         if(x< 2)         break;                 System.out.print("   Want to cancel any item (Y/N):");         ans=br.readLine().toUpperCase();         if(ans.equals("N"))         break;                 //If the user wants to cancell any item         System.out.print("   Which item to cancel, enter item number:");         no=Integer.parseInt(br.readLine());                 for(i=no-1;i< x-1;i++)         {                          order[i]=order[i+1];              amt[i]=amt[i+1];              plates[i]=plates[i+1];                      }            x--;         }         //Displaying Bill        System.out.println("\f");        System.out.println("   Cash Memo\n");        System.out.println("   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");        System.out.println("                                     Four Seasons Hotel                                      ");        System.out.println("   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");        System.out.println("   Item                      No. of plates             Rate                     Amount");        System.out.println("   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");                for (i=0;i< x;i++)         {                    System.out.print("   "+order[i]+ "                "+plates[i]+ "                  "+ amt[i]+ "                      ");              b=plates[i]*amt[i];        System.out.println(b);        bamt=bamt+b;               }               System.out.println("    Bill Amount Rs.                                                            "+bamt);        System.out.println("   ____________________________________________________________________________________");        bamt=bamt+bamt*.125;        System.out.println("   Total Amount including service charge @ 12.5% Rs.                          "+bamt);        System.out.println("   ____________________________________________________________________________________");        System.out.println("                             THANK YOU VISIT AGAIN");               System.out.println("   Press any key to continue :");        String ab=br.readLine();      }

public static void main(String[]args)throws Exception{   //Handling Exceptionsdo{
   try{        object.n=0;        object.i=0;        object.no=0;        object.ans="";               for(int y=0;y<10;y++)        {                   object.order[y]="";          object.amt[y]=0;        object.plates[y]=0;               }               object.putOrder();         //Calling the function putOrder        System.out.print("\f");   //Clearing the Screne    }       catch(ArithmeticException e1)    {        System.out.println("Sorry some problem has occured");           }       catch(ArrayIndexOutOfBoundsException e2)    {             System.out.println("   Sorry we dont have such item"); 
    }       catch(NumberFormatException e3)    {              System.out.println("   The input was not a number therfore an error has occured ");    }       catch(ArrayStoreException e4)    {             System.out.println("   Sorry some problem has occured"   );    }       catch(ClassCastException e5)    {               System.out.println("   An error has occured please run the application again");    }       catch(IllegalArgumentException e6)    {               System.out.println("   An error has occured please run the application again");    }       catch(IllegalStateException e7)    {              System.out.println("   An error has occured please run the application again");    }       catch(IndexOutOfBoundsException e9)    {             System.out.println("   An error has occured please run the application again");    }       catch(NegativeArraySizeException e10)    {            System.out.println("   An error has occured please run the application again");    }       catch(NullPointerException e11)    {            System.out.println("   An error has occured please run the application again");    }       catch(SecurityException e12)    {             System.out.println("   An error has occured please run the application again");    }       catch(UnsupportedOperationException  e13)    {              System.out.println("   An error has occured please run the application again");    }       catch(java.util.InputMismatchException e14)    {             System.out.println("   The Input was wrong therfore an error has occured ");         }       System.out.print("\n   Do you want to continue the Application(Y/N)? :");      object.ch=(char)System.in.read();     //If ch is N or n the Applications ends    object.ch=Character.toUpperCase(object.ch);    System.out.print("\f");      }while(object.ch!='N');   //Loop get excuited as long as ch is not equal to n or N
System.out.println("\f\n                                       T  H  A  N  K   Y  O  U ! !");  }}// Program Ends

Comments

Popular posts from this blog

Banking (ICSE Class 10 Mathematics Project)

BANK ACCOUNT A bank account is a financial account between a bank customer and a financial institution. A bank account can be a deposit account, a credit card, or any other type of account offered by a financial institution. The financial transactions which have occurred within a given period of time on a bank account are reported to the customer on a bank statement and the balance of the account at any point in time is the financial position of the customer with the institution. a fund that a customer has entrusted to a bank and from which the customer can make withdrawals. BANK A bank is a financial institution and a financial intermediary that accepts deposits and channels those deposits into lending activities, either directly by loaning or indirectly through capital markets. A bank links together customers that have capital deficits and customers with capital surplu...

Soils of India (Geography Project)

è Introduction Soil is the mixture of minerals, organic matter, gases, liquids and a myriad of organisms that can support plant life. It is a natural body that exists as part of the pedosphere and it performs four important functions: it is a medium for plant growth; it is a means of water storage, supply and purification; it is a modifier of the atmosphere; and it is a habitat for organisms that take part in decomposition and creation of a habitat for other organisms .Soil is considered the "skin of the earth" with interfaces between the lithosphere, hydrosphere, atmosphere, and biosphere. Soil consists of a solid phase (minerals and organic matter) as well as a porous phase that holds gases and water. Accordingly, soils are often treated as a three-state system .Soil is the end product of the influence of the climate, relief (elevation, orientation, and slope of terrain), biotic activities (or...

Google

Google Screen-reader users, click here to turn off Google Instant. Mrunal Gmail Images My Account Search Maps YouTube Gmail Drive Calendar Google+ Translate Photos Play News Search Add a shortcut More Docs Blogger Contacts Hangouts Keep Books Even more from Google 2 Not listening. Something went wrong. Restart listening Help Hotword detection is off. Start listening for "Ok Google" Google Instant is unavailable. Press Enter to search.   Learn more Google Instant is off due to connection speed. Press Enter to search. Press Enter to search. Report inappropriate predictions × India Google.co.in offered in: हिन्दी বাংলা తెలుగు मराठी தமிழ் ગુજરાતી ಕನ್ನಡ മലയാളം ਪੰਜਾਬੀ Privacy Terms Settings Search settings Advanced search History Search Help Send feedback Advertising Business About Change Mrunal N.C mrunal.n.c22@gmail.com Google+ Profile – Privacy My Account Mrunal N.C mrunal.n.c22@gmail.com (de...