8/8/2019 Java Documentation (Manisha Bhattarai
1/94
8
C1054 Java Programming
Proposal letter
Date: 6th June 2009
To,
The Managing Director,
Dherai-Mitho Khane Kura,
Baneshwor, Kathmandu, Nepal
Sub: to develop a digital order system for your restaurant
Sir/madam,
With reference to the advertisement published in the date 4 th June 2009 in the newspaper, I
would like to design a digital billing system for your restaurant. I have been designing
software for about two years and so I am quite experienced in this field and I am very
confident regarding developing a digital billing system for your restaurant.
As per your requirement published in the newspaper, my qualification and experience in
this field is sufficient to develop a simple console mode digital order system. If you would
like to learn more about my qualifications and experience, I have attached other
documents and certificate with this document.
It will be my pleasure to develop a program for your restaurant. I will be waiting for your
response.
Yours Sincerely,
Manisha Bhattarai
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
2/94
8
C1054 Java Programming
Acceptance letter
Date: 10th June 2009
To,
Miss Manisha Bhattarai,
Ward no. 10,
Baneshwor, Kathmandu, Nepal
Dear, manisha,
This letter has been written to you to inform you that you have been
selected to design a digital order system for our restaurant. I went through your proposal
letter and your qualifications and experience and i am sure that you will fit perfect for this
job.
I also went through your basic designing concept and to learn and discuss more about it I
would like to call you for a meeting on the 12 th of July at our restaurant. To prove your
identity, you should also bring the photocopy of the papers you sent to our restaurant on
the 6th of July.
Me as well as other members of the restaurant will be very pleased to see you and work
with you.
With warm regards,
Hemani Shakya
Dherai Mitho Khane Kura Reataurant,
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
3/94
8
C1054 Java Programming
Technical proposal
Proposed project
name:
Digital food order system
Date of proposal: 6th June 2009
Software
requirement:
Java Development Kit 1.6 and above
Command Prompt
Hardware
requirement:
Pentium - 2 plus
RAM - 128 plus
Processor - 800MHz plus
Hard Disk - 80 GB plus
This project is developed for the Dherai Mitho Khane Kura
restaurant to keep digital record of the bills of the food consumed
by the customers that used to be done in the form of a paper. This
project is mainly developed to eliminate the risk of loss and
damage of bills.
Approved
Date of approval: 10th June 2009
Approved by: Hemani Shakya
Acknowledgement
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
4/94
8
C1054 Java Programming
Creating this program was a very nice and useful experience for me as I not only built my
skills regarding programming but also got a chance to widen to knowledge in this field.
Building this project would be impossible without the help of our instructor Mr. Manoj
Manandhar. So, first of all I would like to give a heartfelt thank to him.
Without the help and co-operation of my friends, I would not have been able to solve my
problems related to programming in the absence of my instructor. So I would also thank
my friends for helping me in the time of need.
Last but not the least, the co-operation and help of the friendly staffs and the environment
provided by the Informatics College also helped me in building my project to this level.
So, thank you to the entire staffs and to the informatics college.
Introduction and program objective
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
5/94
8
C1054 Java Programming
Introduction
I am about to develop a software for Dherai Mitho Khane Kura Restaurant. It is located at
Baneshwor, Kathmandu, Nepal was established about a year ago and has and has been
serving certain variety of food items to the customers visiting the restaurant since then.
Currently, the restaurant has seven employees at the restaurant which includes two cook,
manager, waiters and other employees. Currently this restaurant can serve about only 20
customers a day. The restaurant has been thinking about implementing some kind of new
technology within the organization that would help to improve the standard of the
organization as well as make it easy for the employees within the restaurant.
Current system and Problem Background
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
6/94
8
C1054 Java Programming
Dherai Mitho Khane Kura Restaurant currently has about seven employees including the
manager, waiters and so on. It has been only a year since the restaurant has been
established so the number of customers visiting the restaurant is in average rate. Currently,
the order from the customers is taken by getting one of the waiters into the customers
table. The customers can pay the bill to the restaurant after they consume the food and this
is in the form of a paper. The billing of the food consumed by the customers is maintained
in a paper.
Due to the above mentioned current system, various problems is being faced by the
restaurant. Even though the number of customers visiting the restaurant are in average
rate, due to the lack of waiters at the restaurant the customers sometimes do not get their
order at time. Other major problem the restaurant is facing is due to the billing method.
The record of the bills is maintained in the form of a paper which makes its very
vulnerable to loss and even getting torn out. Sometimes there has also been some kind of
mistake by the waiters due to which the customers were not satisfied by our service and
things like this give a very false impression to the customers. Other problems that the
restaurant is facing due to the current system is that Sometimes customers do not pay for
their food items so there is always insecurity regarding payment of the food consumed by
the customer. Along with all these problems, the restaurant also faces a lot of problem
when the data has to be retrieved from the old records which are very time consuming.
Purposed system and objectives:
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
7/94
8
C1054 Java Programming
To reduce the problems being faced by the restaurant, I introduced software that performs
certain function that will help to eliminate the problems being faced by the restaurant. My
program will use an electronic device i.e. a computer instead of the traditional billing
system where papers were used to keep the record of the bills of the customers. In the
purposed system, the customers have to get to the computer where an employee is present
to get the order of the food and that is before having the food to reduce the insecurity
regarding payment of the food consumed by the customer. In the purposed system, the
records of the bills are maintained in a log file instead of the papers so that the risk of the
papers getting lost and torn out is reduced. The implementation of purposed system will
also help to make the order service more managed and quick.
The major objectives of the purposed system are:
1. To save the time of the customers as well as employees since the order is taken
directly from the computer by the customers.
2. To make it easier for the employees to use and maintain the record.
3. To ensure that the record of the food items consumed is maintained digitally with
the help of the log file.
4. To reduce the loss of bills that used to be stored in the form of paper previously.
5. To introduce modern technique of billing at the restaurant and to encourage others
in implementing this as well.
Program Design
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
8/94
8
C1054 Java Programming
Flowchart
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
9/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Press Enter
Display menu
Enter choice
Is itan
empt
y
inputs?
Is itgreat
er
than
13?
Is it
an
alph
abet?
Yes Yes Yes
No NoNo
Display
Availability
Error Message isDisplayed
8/8/2019 Java Documentation (Manisha Bhattarai
10/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Press Enter
Display menu
Enter choice
Is it
an
empty
input
s?
Is it
great
erthan
13?
Is it
analph
abet?
Yes Yes Yes
No No
No
Enter food
name
Error Message isDisplayed
8/8/2019 Java Documentation (Manisha Bhattarai
11/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Enter food price
Is itan
empt
yinput
?
Error Message isDisplayed
Is itan
empt
y
input
?
Cho
iceto
haveanythingelse
Is itgreat
er
than
40?
Is ita
char
acte
r?
Yes
YesYes Yes
No
No
No No No
Error Message isDisplayed
8/8/2019 Java Documentation (Manisha Bhattarai
12/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Enter food price
Enter food name
Is it
an
empt
y
input
?
Error Message isDisplayed
Is it
an
empt
y
input
?
Error Message is
Displayed
Enter name
Is it
an
empt
yinput
?
Error Message is
Displayed
Is it
a
char
acter
?
Is it
great
er
than
40?
Yes
Yes
Yes Yes Yes
Yes
No
No NoNo
No
Error Message is
Displayed
8/8/2019 Java Documentation (Manisha Bhattarai
13/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Insertion of food name,
price and user name to
the file.
Display bill
Press enter to keep
record on log file
Enter food price
Enter food
name
Is it
an
empt
y
input? Error Message isDisplayed
Is it
great
erthan
40? Error Message isDisplayed
8/8/2019 Java Documentation (Manisha Bhattarai
14/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Enter food name
Is it
analph
abet?
Is it
an
empty
input
?
Yes
YesYes Yes
No No No
No
Error Message isDisplayed
8/8/2019 Java Documentation (Manisha Bhattarai
15/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Enter food price
Is it
an
empt
y
input
?
Error Message isDisplayed
Is it
great
erthan
40?
Error Message isDisplayed
Enter name
Is it
anempt
y
input
?
Error Message is
Displayed
Data is appended to atext file
Is it
an
empty
input
Is it
an
alph
abet?
YesYesYes
Yes
No
No NoNo
YesError Message is
Displayed
8/8/2019 Java Documentation (Manisha Bhattarai
16/94
8
C1054 Java Programming
Input Screen Design
Submitted by: Manisha Bhattarai (1801T1090085)
End
Do
you
wishto
view
log
file?
Log file isviewed
Command Prompt java orderServiceee X
Press Enter to check out the menu!
---------------------------------------------
Welcome to our restaurant!
Yes
No
8/8/2019 Java Documentation (Manisha Bhattarai
17/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
Enter the choice: 99
Type the number present on the right hand side of the food
Command Prompt java orderServiceee X
YOUR CHOICE OF FOOD IS AVAILABLE!
--------------------------------------------------------
Enter the food name: AAAA
Command Prompt java orderServiceee X
Enter the food Price: 99
Command Prompt java orderServiceee X
Please enter the choice: 9
8/8/2019 Java Documentation (Manisha Bhattarai
18/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Do you wish to have anything else?If yes press 1 otherwise press 0
Command Prompt java orderServiceee X
Enter the food name: AAAA
Command Prompt java orderServiceee X
Enter the food Price: 99Command Prompt java orderServiceee X
Please enter your name: AAAA
8/8/2019 Java Documentation (Manisha Bhattarai
19/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
Enter the food name:AAAA
Please enter the data for log file
Command Prompt java orderServiceee X
Enter the food Price: 99
8/8/2019 Java Documentation (Manisha Bhattarai
20/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
Please enter the choice: 9
Do you wish to have anything else?
If yes press 1 otherwise press 0
Command Prompt java orderServiceee X
Enter the food name: AAAA
Command Prompt java orderServiceee X
Enter the food Price: 99Command Prompt java orderServiceee X
Please enter your name: AAAA
8/8/2019 Java Documentation (Manisha Bhattarai
21/94
8
C1054 Java Programming
Output Screen Design
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
Enter the choice:
If you wish to view log file press rIf you do not wish to view log file press anything
Command Prompt java orderServiceee X
Menu
8/8/2019 Java Documentation (Manisha Bhattarai
22/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
----------------------------------------------------------------------
| YOU ENTERED AN EMPTY VALUE |
| |
| TRY AGAIN! |----------------------------------------------------------------------
Command Prompt java orderServiceee X
----------------------------------------------------------------------
| THE VALUE YOU ENTERED IS NOT NUMERIC! |
| |
| TRY AGAIN! |----------------------------------------------------------------------
Command Prompt java orderServiceee X
----------------------------------------------------------------------
| THE CHOICE YOU ENTERED IS INVALID! |
| |
| TRY AGAIN! |----------------------------------------------------------------------
Command Prompt java orderServiceee X
Bill
8/8/2019 Java Documentation (Manisha Bhattarai
23/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Command Prompt java orderServiceee X
LOG FILES
--------------
Bill
8/8/2019 Java Documentation (Manisha Bhattarai
24/94
8
C1054 Java Programming
Program Listing
File name : orderServiceee.java
import java.io.DataInputStream;import java.io.DataOutputStream;
import java.io.File;
Submitted by: Manisha Bhattarai (1801T1090085)
Bill
8/8/2019 Java Documentation (Manisha Bhattarai
25/94
8
C1054 Java Programming
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;import java.io.*;
import java.util.*;
public class orderServiceee
{
public orderServiceee()
{
try
{
File record=new File("text-file//text.txt");
OutputStream os=new FileOutputStream(record);DataOutputStream ds=new DataOutputStream(os);
ds.writeBytes("1__Momo__25__7__Momo__30");
ds.writeBytes("\r\n");
ds.writeBytes("2__Samosa__25__8__----__--");ds.writeBytes("\r\n");
ds.writeBytes("3__Rice__30__9__Rice__30__");
ds.writeBytes("\r\n");ds.writeBytes("4__Chawmin__30__10__----__--");
ds.writeBytes("\r\n");
ds.writeBytes("5__Pakaura__25__11__----__--");ds.writeBytes("\r\n");
ds.writeBytes("6__----__--__12__Meat__40");
ds.flush();ds.close();
InputStream is=new FileInputStream(record);
DataInputStream dis=new DataInputStream(is);String s="";
List list=new ArrayList();
while((s=dis.readLine())!=null)
{
list.add(s);}
System.out.println("\r\n");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
26/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"################################################
#");
System.out.println("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#");System.out.println("\t"+"\t"+"#"+"\t"+" Welcome to our Resturant!"+"\t"+"\t"+"#");
System.out.println("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#");
System.out.println("\t"+"\t"+"#################################################");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.println("\r\n");
System.out.println("\t"+"\t"+"\t"+"Press Enter to check out the menu!");
System.out.println("\t"+"\t"+"\t"+"----------------------------------");
String checkOut=br.readLine();
System.out.println("\r\n");
System.out.println("\t"+"No."+"\t"+"Veg"+"\t"+"\t"+"Price"+"\t"+"No."+"\t"+"Non-
Veg"+"\t"+"\t"+"Price");System.out.println("\t"+"-----------------------------"+"\t"+"-----------------------------");
for(int i=0; i
8/8/2019 Java Documentation (Manisha Bhattarai
27/94
8
C1054 Java Programming
public static void main(String args[])
{
orderServiceee OS=new orderServiceee();
getNum gN=new getNum();
gN.getNumm();
enterName EN=new enterName();
List recod=EN.EnterName();String EN1=recod.get(0).toString();
String EN2=recod.get(1).toString();
int i=EN.Enter_choice();
EN.EnterNamee(EN1,EN2,i);
log_file MP=new log_file();
MP.log_info();
List record=MP.EnterNamem();String rd=record.get(0).toString();
String rd1=record.get(1).toString();int j=MP.get_choice();
MP.EnterNameem(rd,rd1,j);
Read_txtFile R_tF=new Read_txtFile();}
}
File name : getNum.java
import java.io.DataInputStream;
import java.io.DataOutputStream;import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;import java.io.InputStream;
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
28/94
8
C1054 Java Programming
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;import java.io.*;
import java.util.*;
public class getNum
{
public void getNumm(){
try
{
String available="YOUR CHOICE OF FOOD IS AVAILABLE!";
String underline="---------------------------------";
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter your choice:");String cc=br.readLine();
while(cc.trim().length()12){
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -----------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED IS
INVALID!"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
29/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+" -----------------------------------------------");System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Re-enter your choce:");
cc=br.readLine();c=Integer.parseInt(cc);
}
switch(c)
{
case 1:{
System.out.println("\r\n");
System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);System.out.println("\r\n");
}break;
case 2:
{System.out.println("\r\n");
System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);System.out.println("\r\n");
}
break;
case 3:
{System.out.println("\r\n");
System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);
System.out.println("\r\n");}
break;
case 4:{
System.out.println("\r\n");
System.out.println("\r\n"+"\t"+"\t"+"\t"+available);System.out.println("\t"+"\t"+"\t"+underline);
System.out.println("\r\n");
}
break;
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
30/94
8
C1054 Java Programming
case 5:
{System.out.println("\r\n");
System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);System.out.println("\r\n");
}
break;
case 7:
{
System.out.println("\r\n");System.out.println("\r\n"+"\t"+"\t"+"\t"+"Sorry this item is Unavailable");
System.out.println("\t"+"\t"+"\t"+underline);
System.out.println("\r\n");
getNumm();}
break;
case 9:
{
System.out.println("\r\n");System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);
System.out.println("\r\n");}
break;
case 12:
{
System.out.println("\r\n");System.out.println("\r\n"+"\t"+"\t"+"\t"+available);
System.out.println("\t"+"\t"+"\t"+underline);
System.out.println("\r\n");
}break;
}
}
catch(Exception e)
{System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
31/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+" -------------------------------------------------");System.out.println("\r\n");
getNumm();
}}
}
File name : enterName.java
Import java.io.DataInputStream;import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;import java.io.FileOutputStream;
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
32/94
8
C1054 Java Programming
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;import java.util.List;
import java.io.*;
import java.util.*;
public class enterName
{public List EnterName()
{
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food name:"+" ");
String nameInput=br.readLine();
while(nameInput.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
33/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food Price:"+" ");priceInput=br.readLine();
}
int priceInputt=Integer.parseInt(priceInput);
if(priceInputt>40)
{
System.out.println("\r\n");System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED IS
INVALID!"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");priceInput=br.readLine();
priceInputt=Integer.parseInt(priceInput);
}
System.out.println("\r\n"+"\r\n");
List list =new ArrayList();list.add(nameInputt);
list.add(priceInputt);
for(int i=0; i
8/8/2019 Java Documentation (Manisha Bhattarai
34/94
8
C1054 Java Programming
System.out.println("\r\n"+"\r\n");
return list;
}
catch(Exception e)
{System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
return EnterName();}
}
public int Enter_choice()
{
try{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("\r\n");System.out.print("\t"+"\t"+"\t"+"Please enter the choice:"+" ");
String ii=br.readLine();
while(ii.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
35/94
8
C1054 Java Programming
if(ss>1)
{
System.out.println("\r\n");System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED ISINVALID!"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Please Re=enter the value:"+" ");ii=br.readLine();
ss=Integer.parseInt(ii);
}
return ss;}
catch(Exception e)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
return Enter_choice();}
}
public void EnterNamee(String neww, String neww1,int jj){
try
{BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
switch(jj){
case 0:
{
System.out.println("\r\n"+"\r\n");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
36/94
8
C1054 Java Programming
System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");
String name_one=br.readLine();
while(name_one.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
37/94
8
C1054 Java Programming
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"ENJOY YOUR FOOD
"+name_two+"!"+"\t"+"\t\t"+"#");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.writeBytes("\t"+"\t"+"###############################################
##");
dos_two.flush();dos_two.close();
InputStream is_two=new FileInputStream(file_two);
DataInputStream dis_two=new DataInputStream(is_two);String disp="";
while((disp=dis_two.readLine())!=null)
{System.out.println(disp);
}System.out.println();
}
break;
case 1:
{
System.out.println("\r\n");System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food name:"+" ");
String nameInput_two=br.readLine();
while(nameInput_two.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
38/94
8
C1054 Java Programming
System.out.println("");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");
String priceInput_two=br.readLine();
while(priceInput_two.trim().length()40)
{System.out.println("\r\n");
System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED IS
INVALID!"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+" -----------------------------------------------");System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food Price:"+" ");
priceInput_two=br.readLine();
priceInputtt=Integer.parseInt(priceInput_two);}
System.out.println("\r\n");System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");
String name_one=br.readLine();
while(name_one.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
39/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+" YOU ENTERED AN EMPTY
VALUE!"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");name_one=br.readLine();
}
String name_two=name_one.toUpperCase();System.out.print("\r\n"+"\r\n");
int priceInput_three=Integer.parseInt(neww1);
int priceInput_four=Integer.parseInt(priceInput_two);
int priceOutput=priceInput_three+priceInput_four;
File file_two=new File("text-file//text_2.txt");OutputStream os_2=new FileOutputStream(file_two);
DataOutputStream dos_three=new DataOutputStream(os_2);
dos_three.writeBytes("\r\n"+"\t"+"\t"+"#########################################
########");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"DHERAI MITHO KHANEKURA
RESTURANT"+"\t"+"#");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"Naya-Baneshwor, Kathmandu,
Nepal"+"\t"+"#");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"Food-Item"+"\t\t"+"Price-RS."+"\t"+"#");
dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+neww+"\t\t\t"+neww1+"\t\t"+"#");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+nameInputtt+"\t\t\t"+priceInputtt+"\t\t"+"#");
dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"Total:"+"\t\t\t"+priceOutput+"\t\t"+"#");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
40/94
8
C1054 Java Programming
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"#"+"\t"+"ENJOY YOUR FOOD
"+name_two+"!"+"\t"+"\t\t"+"#");dos_three.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.writeBytes("\t"+"\t"+"##############################################
###");dos_three.flush();
dos_three.close();
InputStream is_3=new FileInputStream(file_two);
DataInputStream dis_3=new DataInputStream(is_3);
String disp_1="";
while((disp_1=dis_3.readLine())!=null)
{
System.out.println(disp_1);
}}
break;}
}
catch(Exception e){
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
EnterNamee(neww,neww1,jj);
}}
}
File name : log_file.java
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;import java.io.FileInputStream;
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
41/94
8
C1054 Java Programming
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;import java.util.ArrayList;
import java.util.List;
import java.io.*;import java.util.*;
public class log_file{
public void log_info()
{System.out.println("\r\n");
System.out.println("\t"+"\t"+"################################################
#");
System.out.println("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#");System.out.println("\t"+"\t"+"#"+"\t"+"Please enter the data for log file"+"\t"+"#");
System.out.println("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#");System.out.println("\t"+"\t"+"################################################
#");
System.out.println("\r\n"+"\r\n");
}
public List EnterNamem()
{try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food name:"+" ");
String nameInput=br.readLine();
while(nameInput.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
42/94
8
C1054 Java Programming
}
String nameInputt=nameInput.toUpperCase();System.out.println("");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");
String priceInput=br.readLine();
while(priceInput.trim().length()40)
{System.out.println("\r\n");
System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED IS
INVALID!"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\r\n");System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");
priceInput=br.readLine();
priceInputt=Integer.parseInt(priceInput);}
System.out.println("\r\n"+"\r\n");List list =new ArrayList();
list.add(nameInputt);
list.add(priceInputt);
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
43/94
8
C1054 Java Programming
for(int i=0; i
8/8/2019 Java Documentation (Manisha Bhattarai
44/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+" YOU ENTERED AN EMPTY
VALUE!"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
System.out.print("\t"+"\t"+"\t"+"Re-Enter your choice:"+" ");ii=br.readLine();
}
int ss=Integer.parseInt(ii);if(ss>1)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -----------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED ISINVALID!"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\r\n");
System.out.print("\t"+"\t"+"\t"+"Re-Enter your choice:"+" ");ii=br.readLine();
ss=Integer.parseInt(ii);
}return ss;
}
catch(Exception e)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
return get_choice();
}
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
45/94
8
C1054 Java Programming
}
public void EnterNameem(String neww, String neww1, int m){
try
{BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
switch(m){
case 0:
{
System.out.println("\r\n");System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");
String name_one=br.readLine();
while(name_one.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
46/94
8
C1054 Java Programming
dos_two.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"Food-Item"+"\t\t"+"Price-RS."+"\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+neww+"\t\t\t"+neww1+"\t\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.write("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"Total:"+"\t\t\t"+neww1+"\t\t"+"#");dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n"dos_two.write(
"\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"ENJOY YOUR FOOD
"+name_two+"!"+"\t"+"\t\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_two.write("\t"+"\t"+"#################################################");
dos_two.close();}
break;
case 1:{
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food name:"+" ");
String nameInput_two=br.readLine();
while(nameInput_two.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
47/94
8
C1054 Java Programming
String priceInput_two=br.readLine();
while(priceInput_two.trim().length()40)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -----------------------------------------------");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"THE CHOICE YOU ENTERED IS
INVALID!"+"\t"+"|");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+"\t"+"|");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"|");System.out.println("\t"+"\t"+" -----------------------------------------------");
System.out.println("\r\n");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food Price:"+" ");priceInput_two=br.readLine();
priceInputtt=Integer.parseInt(priceInput_two);
}
System.out.println("\r\n");
System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");
String name_one=br.readLine();while(name_one.trim().length()
8/8/2019 Java Documentation (Manisha Bhattarai
48/94
8
C1054 Java Programming
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\r\n");
System.out.print("\t"+"\t"+"\t"+"Please re-enter your name:"+" ");name_one=br.readLine();
}
String name_two=name_one.toUpperCase();
System.out.print("\r\n"+"\r\n");
int priceInput_three=Integer.parseInt(neww1);
int priceInput_four=Integer.parseInt(priceInput_two);int priceOutput=priceInput_three+priceInput_four;
BufferedWriter dos_three = new BufferedWriter(new FileWriter("text-file//text_3.txt",
true));dos_three.write("\r\n"+"\t"+"\t"+"#############################################
####");dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"DHERAI MITHO KHANEKURA
RESTURANT"+"\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+"Naya-Baneshwor, Kathmandu, Nepal"+"\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"Food-Item"+"\t\t"+"Price-RS."+"\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+neww+"\t\t\t"+neww1+"\t\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+nameInputtt+"\t\t\t"+priceInputtt+"\t\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+"Total:"+"\t\t\t"+priceOutput+"\t\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");dos_three.write("\t"+"\t"+"#"+"\t"+"ENJOY YOUR FOOD
"+name_two+"!"+"\t"+"\t\t"+"#");
dos_three.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_three.write("\t"+"\t"+"#################################################");
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
49/94
8
C1054 Java Programming
dos_three.close();
}
break;}
}
catch (Exception e)
{
System.out.println("\r\n");System.out.println("\t"+"\t"+" -------------------------------------------------");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"THE VALUE YOU ENTERED IS NOT
NUMERIC!"+"\t"+" |");System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"TRY AGAIN!"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+"|"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" |");
System.out.println("\t"+"\t"+" -------------------------------------------------");System.out.println("\r\n");
EnterNameem(neww,neww1,m);}
}
}
File name : Read_txtFile.java
import java.io.DataInputStream;import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;import java.io.FileOutputStream;
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
50/94
8
C1054 Java Programming
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;import java.util.List;
import java.io.*;
import java.util.*;
public class Read_txtFile
{File file=new File("text-file//text_3.txt");
public Read_txtFile()
{try
{
System.out.println("\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx");System.out.println("\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" x");
System.out.println("\t"+"x"+"\t"+" If you wish to view the log file press r"+"\t"+"\t"+"x");
System.out.println("\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" x");
System.out.println("\t"+"x"+"\t"+"If you do not wish to view log file press
anything"+"\t"+" x");System.out.println("\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" x");
System.out.println("\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx");
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter your choice:"+" ");String choice_r=br.readLine();
int choice=0;
if(choice_r.equals("r"))
{
choice=1;
}
switch(choice)
{case 1:
{
InputStream is=new FileInputStream(file);DataInputStream dis=new DataInputStream(is);
String line="";
List list=new ArrayList();
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
51/94
8
C1054 Java Programming
while((line=dis.readLine())!=null)
{
list.add(line);}
System.out.println("\r\n");System.out.println("\t"+"\t"+"\t"+"\t"+"LOG FILES");
System.out.println("\t"+"\t"+"\t"+"\t"+"----------");
for(int i=0;i
8/8/2019 Java Documentation (Manisha Bhattarai
52/94
8
C1054 Java Programming
Test cases Objectives
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
53/94
8
C1054 Java Programming
To examine whether the program is compiled or not.
2. To examine whether the program runs or not.
3. To examine whether the program displays the menu when enter is pressed
4.To examine To examine the box displaying the food choice information appears or not.
To examine whether food choice accepts empty input or not
6. To examine whether food choice accepts a character or not
7. To examine whether food choice accepts number greater than 12 or not
8. To examine whether the availability of food is displayed or not after the choice
is entered.
9. To examine whether food name accepts empty input or not
10. To examine whether food price accepts empty input or not
11. To examine whether food price accepts a character or not
12. To examine whether food price accepts number greater than 40 or not.
13.To examine To examine whether a box to order another food item appears or not.
14. To examine whether choice accepts empty input or not
15. To examine whether choice accepts a character or not
16. To examine whether choice accepts number greater than one or not
17. To examine whether name accepts empty input or not
To examine whether the food price, food name and customers name is written
on a file or not
19. To examine whether the bill is displayed or not
20. To examine whether data is appended on a file or not
21. To examine whether the program asks for the same data to be entered for the
log file or not
22. To examine whether a box that gives choice to view log file appears or not
23. To examine whether the log file is displayed or not when r is pressed
24. To examine whether the program exits or not from the system when choices
other than r is pressed
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
54/94
8
C1054 Java Programming
Test cases and result
Test case: 1
To examine whether the program is compiled or not
Test Data: Javac orderservicee.java
Expected Test Result: The program should be compiled
Actual Test Result: The program is compiled
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
55/94
8
C1054 Java Programming
Test case: 2
To examine whether the program runs or not
Test Data: Java orderservicee.java
Expected Test Result: Program must display welcome message
Actual Test Result: Program displayed welcome message
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
56/94
8
C1054 Java Programming
Test case: 3
To examine whether the program displays the menu when enter is
pressed
Test Data: enter
Expected Test Result: Menu should be displayed
Actual Test Result: Menu was displayed
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
57/94
8
C1054 Java Programming
Test case: 4
Objective: To examine the box displaying the food choice information
appears or not.
Test Data: blank
Expected Test Result: A message box must appear
Actual Test Result: A message box appears
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
58/94
8
C1054 Java Programming
Test case: 5
Objective: To examine whether food choice accepts empty input or not
Test Data: enter
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
59/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Test case: 6
Objective: To examine whether food choice accepts a character or not
Test Data: A
Expected Test
Result:
Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
8/8/2019 Java Documentation (Manisha Bhattarai
60/94
8
C1054 Java Programming
Test case: 7
To examine whether food choice accepts number greater than 12
or notTest Data: 13
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
61/94
8
C1054 Java Programming
Test case: 8
Objective: To examine whether the availability of food is displayed or notafter the choice is entered.
Test Data: enter
Expected Test Result: A message saying Available or Unavailable should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
62/94
8
C1054 Java Programming
Test case: 9
Objective: To examine whether food name accepts empty input or not
Test Data: enter
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
63/94
8
C1054 Java Programming
Test case: 10
Objective: To examine whether food price accepts empty input or not
Test Data: enter
Expected Test Result: Error message should appearActual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
64/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Test case: 11
Objective: To examine whether food price accepts a character or not
Test Data: B
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
8/8/2019 Java Documentation (Manisha Bhattarai
65/94
8
C1054 Java Programming
Test case: 12
To examine whether food price accepts number greater than 40 or
not.
Test Data: 42
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
66/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Test case: 13
Objective: To examine whether a box to order another food item appears or
not.
Test Data: blank
Expected Test Result: Box with a message should appear
Actual Test Result: Box with a message appears
Conclusion: The command was executed without any error
8/8/2019 Java Documentation (Manisha Bhattarai
67/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Test case: 14
Objective: To examine whether choice accepts empty input or notTest Data: enter
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
8/8/2019 Java Documentation (Manisha Bhattarai
68/94
8
C1054 Java Programming
Submitted by: Manisha Bhattarai (1801T1090085)
Test case: 15
Objective: To examine whether choice accepts a character or not
Test Data: C
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
8/8/2019 Java Documentation (Manisha Bhattarai
69/94
8
C1054 Java Programming
Test case: 16
Objective: To examine whether choice accepts number greater than one or
not
Test Data: 3
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
70/94
8
C1054 Java Programming
Test case: 17
Objective: To examine whether name accepts empty input or not
Test Data: enter
Expected Test Result: Error message should appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
71/94
8
C1054 Java Programming
Test case: 18
Objective: To examine whether the food price, food name and customers
name is written on a txt file or not
Test Data: enter
Expected Test Result: This information should be written on a file
Actual Test Result: This information were written on a file
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
72/94
8
C1054 Java Programming
Test case: 19
Objective: To examine whether the bill is displayed or not
Test Data: enter
Expected Test Result: Bill should be displayed
Actual Test Result: Bill displayed
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
73/94
8
C1054 Java Programming
Test case: 20
Objective: To examine whether data is appended on a txt file or not
Test Data: blank
Expected Test Result: Data should append on a file
Actual Test Result: Data was appended on a file
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
74/94
8
C1054 Java Programming
Test case: 21
Objective: To examine whether the program asks for the same data to be
entered for the log file or not
Test Data: blank
Expected Test Result: A box with a message should appear
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
75/94
8
C1054 Java Programming
Actual Test Result: A box with a message appears
Conclusion: The command was executed without any error
Test case: 22
Objective: To examine whether a box that gives choice to view log file
appears or not
Test Data: blank
Expected Test Result: A box with a message should appear
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
76/94
8
C1054 Java Programming
Actual Test Result: A box with a message appears
Conclusion: The command was executed without any error
Test case: 23
Objective: To examine whether the log file is displayed or not when r is
pressed
Test Data: R
Expected Test Result: Log file must display
Actual Test Result: Log file was displayed
Conclusion: The command was executed without any error
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
77/94
8
C1054 Java Programming
Test case: 24
Objective: To examine whether the program exits or not from the system
when choices other than r is pressed
Test Data: enter
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
78/94
8
C1054 Java Programming
Expected Test Result: The program must exit
Actual Test Result: The program exit from the system
Conclusion: The command was executed without any error
Test log
Test cases Status
1. Successful
2. Successful
3. Successful
4. Successful
5. Successful
6. Successful
7. Successful
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
79/94
8
C1054 Java Programming
8. Successful
9. Successful
10. Successful
11. Successful
12. Successful
13. Successful
14. Successful
15. Successful
16. Successful
17. Successful
18. Successful
19. Successful
20. Successful
21. Successful
22. Successful
23. Successful
24. Successful
System requirement
Software requirement
Jdk (Java Development Kit) 1.6 plus
Windows command prompt
Notepad
Hardware requirement
Pentium - 2 plus
RAM - 128 plus
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
80/94
8
C1054 Java Programming
Processor- 800MHz plus
Hard Disk- 80 GB plus
User manual
Users should follow following steps to run my program:
Step 1
Go to the command prompt and make sure the path to the java/jdk/bin is set.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
81/94
8
C1054 Java Programming
Step 2
Type the name of the file i.e. java orderServicee and press enter
Step 3
Press enter to view the menu of food items
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
82/94
8
C1054 Java Programming
Step 4
Enter any one of the choice i.e. a number mentioned on the left hand side of the food item
of the menu.
Step 5
After the availability message is displayed, enter the name of the food
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
83/94
8
C1054 Java Programming
Step 6
Then enter the price of the food.
Step 7
Now if you wish to order another food item enter 1 otherwise press 0.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
84/94
8
C1054 Java Programming
Step 8
If you press 1, type the name of another food item.
Step 9
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
85/94
8
C1054 Java Programming
Then type the price of that particular food item.
Step 10
After that type the name of the customer.
Step 11
Finally the bill of the customer will be displayed that will be printed with the help of a
printer.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
86/94
8
C1054 Java Programming
Step 13
Now to keep the data on the log file again enter the name of the food item.
Step 12
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
87/94
8
C1054 Java Programming
Then enter the price of the food.
Step 13
Now if you wish to order another food item enter 1 otherwise press 0.
Step 14
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
88/94
8
C1054 Java Programming
If you press 1, type the name of another food item.
Step 15
Then type the price of that particular food item.
Step 16
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
89/94
8
C1054 Java Programming
After that type the name of the customer.
Step 17
Now if you wish to view log file press r otherwise press any key.
Step 18
If you press r the log file will be displayed and finally the program will terminate.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
90/94
8
C1054 Java Programming
Conclusion
This program is mainly developed to implement new billing system at the restaurant for
the easiness of both employees of the restaurant and the customers as well. The project is
now complete and soon the restaurant will implement it in their restaurant.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
91/94
8
C1054 Java Programming
Building this project not only helped me in polishing my skills regarding programming but
also helped me to broaden my knowledge in this field.
Program Strength
1. The program is not time consuming which helps to save the time of both
employees as well as the customers.
2. The log file of the bills maintained by this program makes the records less
vulnerable to loss and damages in comparison to papers.
3. The employee can insert and can view the records of the bills easily.
4. This program does not require complex hardware devices or software
applications.
5. There is no necessity to have complex knowledge about java programming to run
this program. So, anyone can use this program without much difficulty.
Program Weakness
1. This program can only run in console mode which is not quite used in todays
context.
2. This program can only take order of two items.
3. The data and time cannot be mentioned in the program. So, it is difficult to
determine at what time and which date the customers consumed the food.
Program Enhancements
1. The program will be made more attractive and one that will support GUI.
2. The program will be coded in such a way that more number of food items can
be ordered.
Submitted by: Manisha Bhattarai (1801T1090085)
8/8/2019 Java Documentation (Manisha Bhattarai
92/94
8
C1054 Java Programming
3. Date and time will be inserted in the program so that it can be inserted in the
record.
4. In addition to appending and retrieving option that already exists in the program,
a delete option will be added so that unnecessary or incorrect data can bedeleted from the record.
5. Security measures will be implemented in the program so that only authorized
person can append, retrieve and delete the record from the file.
References
Title: Package Summary
URL address: http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-summary.html
Submitted by: Manisha Bhattarai (1801T1090085)
http://java.sun.com/j2se/1.4.2/docs/api/java/io/package-summary.htmlhttp://java.sun.com/j2se/1.4.2/docs/api/java/io/package-summary.html8/8/2019 Java Documentation (Manisha Bhattarai
93/94
8
C1054 Java Programming
Title: Beginners Java Tutorial
URL address: http://www.roseindia.net/java/beginners/index.shtml
Submitted by: Manisha Bhattarai (1801T1090085)
http://www.roseindia.net/java/beginners/index.shtmlhttp://www.roseindia.net/java/beginners/index.shtml8/8/2019 Java Documentation (Manisha Bhattarai
94/94
C1054 Java Programming
Turnitin O riginality Report