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...

WALL OF THORAX-Anatomy Notes

1 WALL OF THORAX DESCRIBE COURSE, BRANCHES AND DISTRIBUTION OF TYPICAL INTERCOSTAL NERVE (LE). There are 12 thoracic spinal nerves. The 3 rd  to 6th nerves lie in typical intercostal spaces between typical ribs. They are confined to the thoracic wall. Formation: The thoracic spinal nerve is formed by anterior and posterior roots, which arises from the anterior and posterior horns of spinal cord respectively. The anterior and posterior roots join together to form the trunk. The trunk divides into anterior and posterior rami. The anterior ramus forms the intercostal nerve. Course: The nerve passes through the respective intervertebral foramen and appears in the posterior part of the intercostal spaces. On reaching the angle of the upper rib, the trunk of the nerve passes forwards along the costal groove between intercostalis internus and intimus muscle. Intercostal nerves runs in the costal groove and ends near the sternum. 2 In the costal groove...

KARYOTYPE

 A karyotype refers to a full set of chromosomes from an individual arranged according to length, position of centromere, banding pattern.  Karyotype is written as total number of chromosomes followed by sex chromosomes  Normal male karyotype: 46,XY, normal female karyotype: 46,XX  Chromosomes are classified into 7 groups and pasted accordingly- Group A- 1, 2, 3; group B- 4, 5; group C- 6-12, X; group D- 13, 14, 15; group E- 16, 17, 18; group F- 19, 20; group G- 21, 22, Y