Acknowledgement
The success and final outcome of this project required a lot of guidance and assistance from many people and I am extremely fortunate to have got this all along the completion of my project work. Whatever I have done is only due to such guidance and assistance and I would not forget to thank them.
I owe my profound
gratitude to our project guide (SUBJECT TEACHER’S NAME)ma’am, who took keen interest on our
project work and guided us all along, till the completion of our project work
by providing all the necessary information for developing a good system.
I am thankful to and
fortunate enough to get constant encouragement, support and guidance from all
Teaching staffs of Department of computer science which helped us in
successfully completing our project work. Also, I would like to extend our
sincere regards to all the non-teaching staff of department of computer science
for their timely support.
(YOUR NAME)
Introduction
Java is
a general-purpose computer programming language that
is concurrent, class-based, object-oriented, and specifically
designed to have as few implementation dependencies as possible. It is intended
to let application developers "write once, run anywhere" (WORA),
meaning that code that runs on one platform does not need to be recompiled to
run on another. Java applications are
typically compiled to bytecode that can run on
any Java virtual machine (JVM) regardless of computer
architecture. Java is, as of 2014, one of the most popular programming
languages in use, particularly for client-server web applications, with a
reported 9 million developers. Java was originally developed by James
Gosling at Sun Microsystems (which has since merged into Oracle
Corporation) and released in 1995 as a core component of Sun
Microsystems' Java platform. The language derives much of
its syntax from C and C++, but it has
fewer low-level facilities than either of them.
The original and reference
implementation Java compilers, virtual machines, and class
libraries were originally released by Sun under proprietary licenses. As
of May 2007, in compliance with the specifications of the Java Community
Process, Sun relicensed most of its Java technologies under the GNU
General Public License. Others have also developed alternative implementations
of these Sun technologies, such as the GNU Compiler for Java(bytecode
compiler), GNU Classpath (standard libraries), and IcedTea-Web
(browser plugin for applets).
History of Java
James
Gosling, Mike Sheridan, and Patrick Naughton initiated the Java
language project in June 1991. Java was originally designed for
interactive television, but it was too advanced for the digital cable television
industry at the time. The language was initially called Oak after
an oak tree that stood outside Gosling's office. Later the project
went by the name Green and was finally renamed Java,
from Java coffee, said to be consumed in large quantities by the
language's creators. Gosling designed Java with a C/C++-style syntax that
system and application programmers would find familiar.
Sun Microsystems released the first public implementation
as Java 1.0 in 1995. It promised "Write Once, Run Anywhere" (WORA),
providing no-cost run-times on popular platforms. Fairly secure and
featuring configurable security, it allowed network- and file-access
restrictions. Major web browsers soon incorporated the ability to
run Java applets within web pages, and Java quickly became popular.
The Java 1.0 compiler was re-written in
Java by Arthur van Hoff to comply strictly with the Java 1.0
language specification. With the advent of Java 2 (released
initially as J2SE 1.2 in December 1998 – 1999), new versions had multiple
configurations built for different types of platforms. J2EE included
technologies and APIs for enterprise applications typically run in server
environments, while J2ME featured APIs optimized for mobile
applications. The desktop version was renamed J2SE. In 2006, for marketing
purposes, Sun renamed new J2 versions as Java EE, Java ME,
and Java SE, respectively.
In 1997, Sun Microsystems approached the ISO/IEC JTC
1 standards body and later the Ecma International to formalize
Java, but it soon withdrew from the process.Java remains a de
facto standard, controlled through the Java Community
Process. At one time, Sun made most of its Java implementations available
without charge, despite their proprietary software status. Sun generated
revenue from Java through the selling of licenses for specialized products such
as the Java Enterprise System.
On November
13, 2006 , Sun released much of Java as free and open-source
software, (FOSS), under the terms of the GNU General Public
License (GPL). On May 8,
2007 , Sun finished the process, making all of Java's core code
available under free software/open-source distribution terms, aside from a
small portion of code to which Sun did not hold the copyright.
Sun's vice-president Rich Green said that Sun's ideal role with
regards to Java was as an "evangelist". Following Oracle
Corporation's acquisition of Sun Microsystems in 2009–2010, Oracle has
described itself as the "steward of Java technology with a relentless
commitment to fostering a community of participation and
transparency". This did not prevent Oracle from filing a lawsuit
against Google shortly after that for using Java inside the Android SDK.
Java software runs on everything
from laptops to data centers, game consoles to
scientific supercomputers. There are 930 million Java Runtime
Environment downloads each year and 3 billion mobile phones run
Java. On April 2, 2010 ,
James Gosling resigned from Oracle.
Features of Java
There
is given many features of java. They are also known as java buzzwords. The Java
Features given below are simple and easy to understand.
1. Simple
2. Object-Oriented
3. Platform independent
4. Secured
5. Robust
6. Architecture neutral
7. Portable
8. Dynamic
9. Interpreted
10. High Performance
11. Multithreaded
12. Distributed
CODE
//AUTHOR OF THE PROJECT: Mrunal.N.C
import java.io.*;
//Importing java.io package
import java.util.*; //Importing java.util package
import java.net.*;
//Importing java.net package
import java.awt.*;
//Importing java.awt package
import java.nio.*; //Importing
java.nio package
import 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
Exceptions
do{
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
OUTPUT
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Four Seasons Hotel
Menu Card
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No.
Item Rate/plate
1:
Full Meals 200.0
2:
Dum Aloo 75.0
3:
Dosa 35.0
4:
Naan
45.0
5:
Palak Paneer 75.0
6: Dal
55.0
7:
Mini Meals 155.0
8:
Samosa 20.0
9: Fried Rice 40.0
10:
Chana Masala
65.0
Enter item number from 1 to 10 to place
order
Please enter the item number: 1
Please Enter the number of plates: 5
Any More Item ?(Y/N): N
Cash Memo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Four Seasons Hotel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No. of
plates Rate Amount
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Full Meals 5 200.0 1000.0
Bill Amount Rs.
1000.0
____________________________________________________________________________________
Total Amount including service charge @
12.5% Rs.
1125.0
____________________________________________________________________________________
THANK YOU VISIT AGAIN
Press any key to continue : Q
Do you want to continue the Application(Y/N)?
:Y
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Four Seasons Hotel
Menu Card
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No.
Item
Rate/plate
1:
Full Meals 200.0
2:
Dum Aloo 75.0
3:
Dosa
35.0
4:
Naan
45.0
5: Palak Paneer 75.0
6:
Dal
55.0
7:
Mini Meals 155.0
8: Samosa 20.0
9:
Fried Rice 40.0
10:
Chana Masala
65.0
Enter item number from 1 to 10 to place
order
Please enter the item number :4
Please Enter the number of plates :5
Any More Item ?(Y/N):Y
Please enter the item number :7
Please Enter the number of plates :5
Any More Item ?(Y/N):Y
Please enter the item number :7
Please Enter the number of plates :8
Any More Item ?(Y/N):Y
Please enter the item number :7
Please Enter the number of plates :9
Any More Item ?(Y/N):N
You have ordered
Item Rate No. of Plates
1: Naan
45.0
5
2: Mini Meals
155.0 5
3: Mini Meals
155.0
8
4: Mini Meals
155.0
9
Want to cancel any item (Y/N):Y
Which item to cancel, enter item number:1
Want to cancel any item (Y/N):Y
Which item to cancel, enter item number:4
Want to cancel any item (Y/N):N
Cash Memo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Four Seasons Hotel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No. of
plates Rate Amount
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mini Meals 5 155.0 775.0
Mini Meals 8 155.0 1240.0
Bill Amount Rs.
2015.0
____________________________________________________________________________________
Total Amount including service charge @
12.5% Rs.
2266.875
____________________________________________________________________________________
THANK YOU VISIT AGAIN
Press any key to continue :5
Do you want to continue the Application(Y/N)?
:Y
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Four Seasons Hotel
Menu Card
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No.
Item
Rate/plate
1:
Full Meals 200.0
2:
Dum Aloo 75.0
3: Dosa
35.0
4:
Naan
45.0
5:
Palak Paneer 75.0
6: Dal
55.0
7:
Mini Meals 155.0
8:
Samosa 20.0
9:
Fried Rice 40.0
10:
Chana Masala
65.0
Enter item number from 1 to 10 to place
order
Please enter the item number :1
Please Enter the number of plates :2
Any More Item ?(Y/N):Y
Please enter the item number :8
Please Enter the number of plates :9
Any More Item ?(Y/N):Y
Please enter the item number :5
Please Enter the number of plates :4
Any More Item ?(Y/N):N
You have ordered
Item
Rate No.
of Plates
1: Full Meals
200.0
2
2: Samosa
20.0
9
3: Palak Paneer
75.0 4
Want to cancel any item (Y/N):N
Cash Memo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Four Seasons Hotel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Item No. of
plates Rate Amount
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Full Meals 2 200.0 400.0
Samosa 9 20.0 180.0
Palak Paneer 4 75.0 300.0
Bill Amount Rs. 880.0
____________________________________________________________________________________
Total Amount including service charge @
12.5% Rs.
990.0
____________________________________________________________________________________
THANK YOU VISIT AGAIN
Press any key to continue :
Do you want to continue the
Application(Y/N)? :N
T H A
N K Y O U ! !
(Note: A 5 lines gap indicate the screen has been cleared
and the fresh MESSAGE is being DISPLAYED)
Comments
Post a Comment