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 surpluses. The word bank was borrowed in Middle English from Middle French banque, from Old Italian banca

Sarvepalli Radhakrishnan- Class 10 History ICSE Project

Sarvepalli Radhakrishnan Sarvepalli Radhakrishnan listen    (5 September 1888 – 17 April 1975) was an Indian philosopher and statesman who served as the first Vice President of India (1952–1962) and the second President of India (1962-1967). Sarvepalli Radhakrishnan was born on September 5, 1888 at Tirutani, Madras in a poor Brahmin family. As his father was poor Radhakrishnan supported most of his education through scholarships.  His father worked as a subordinate revenue official in the service of a local zamindar (landlord) and the family was a modest one. He did not want his son to receive an English education and wanted him to become a priest. But life had other plans for the young boy.   Dr. Sarvepalli Radhakrishnan had his early education at Gowdie School, Tiruvallur and then went to the Lutheran Mission School in Tirupati for his high school. He joined the Voorhee's College in Vellore and later switched to the Madras Christian College. He chose Philosophy as his ma

ICSE Class X - Math Project (Types of Bank Accounts in India)

Types of Bank Accounts in India With the advancement in banking technology, many banks are offering tailor made products to suit individual needs. While accounts may differ from bank to bank their purpose remain the same. Many banks have different products on the basis of customer's age, income and gender. Here are a few different kinds of bank accounts. There are mainly three types of Banking accounts in India: Demand Deposits Term Deposits Non-Resident Deposits Now, we will study one by one, starting from Demand Deposits. 1. Demand Deposit In these types of accounts, money is payable on demand. It includes current accounts and savings accounts ( CASA - Current Account and Savings Account ) (A)  Savings account:  A savings account is an interest-bearing account held at a bank.   There are mainly three types of saving accounts in Indian banks:          (i) Basic Savings Bank Deposit Accounts (BSBDA)          (ii) Basic Saving Bank Deposit Acco