You are on page 1of 94

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 4th 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
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 12th 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
C1054 Java Programming

Technical proposal

Proposed project Digital food order system


name:
Date of proposal: 6th June 2009

Software Java Development Kit 1.6 and above


requirement: Command Prompt

Hardware Pentium - 2 plus


requirement: 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
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
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
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
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
C1054 Java Programming

Flowchart

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Press Enter

Error Message is
Display menu Displayed

Enter choice
Display
Availability

Is it
Is it
Is it an
Yes great Yes Yes
an empt
er
alph y
than
abet? input
13?
s?

No
No No

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Press Enter

Display menu

Enter choice

Is it
Is it
Is it an
Yes great Yes Yes
an empt
er
alph y
than
abet? input
13?
s?

No
No No

Enter food
name

Submitted by: Manisha Bhattarai (1801T1090085)


Error Message is
8
Displayed
C1054 Java Programming

Is it
an
Error Message is empt Yes Error Message is
Displayed y Displayed
input
?

No

Enter food price

Is it
Is it Is it an
Yes a empt
great Yes Yes
char er y
acte than input
40? ?
r?

No No No

Cho
ice
to No
have
anyt
hing
else

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Yes

Enter food name

Is it
an
empt Yes
Error Message is y Error Message is
Displayed Displayed
input
?

No

Enter food price

Is it
Is it Is it an
Yes a great Yes empt Yes
char er y Error Message is
acter than input Displayed
? 40? ?

No
No No

Enter name

Is it
an
empt Yes
y Error Message is
Displayed
input
?

No

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Insertion of food name,


price and user name to
the file.

Display bill

Press enter to keep


record on log file

Enter food
name
Is it
Is it
an
great
empt
er
Submitted
y
than by: Manisha Bhattarai (1801T1090085)
input Error Message is
8
40?price
Enter food
? Displayed
C1054 Java Programming

Error Message is Yes


Displayed

No

Is it
Is it an
Yes an empt Yes Yes
alph y
abet? input
?

No No No

Enter food name

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Is it
an
empt Yes
Error Message is y Error Message is
Displayed Displayed
input
?

No

Enter food price

Is it
an Is it Is it
Yes alph an Yes great Yes
abet empt er Error Message is
y than Displayed
?
input 40?

No
No No

Enter name

Is it
an
empt Yes
y Error Message is
Displayed
input
?

Data is appended to a
text file

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Do
you
wish No
to
view
log
file?

Yes

Log file is
viewed

End

Input Screen Design

Command Prompt– java orderServiceee X

Welcome to our restaurant!

Press Enter toSubmitted


check out theby:menu!
Manisha Bhattarai (1801T1090085)
--------------------------------------------- 8
C1054 Java Programming

Command Prompt– java orderServiceee X

Type the number present on the right hand side of the food

Enter the choice: 99

Command Prompt– java orderServiceee X

YOUR CHOICE OF FOOD IS AVAILABLE!


--------------------------------------------------------

Enter the food name: AAAA

Command Prompt– java orderServiceee X


Command Prompt– java orderServiceee X

Enter the food Price: 99

Please enter theSubmitted


choice: 9 by: Manisha Bhattarai (1801T1090085) 8
C1054 Java Programming

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

Command Prompt– javathe


Enter orderServiceee
food Price: 99 X

Please enter your name: AAAA


Submitted by: Manisha Bhattarai (1801T1090085)
8
C1054 Java Programming

Command Prompt – java orderServiceee X

Please enter the data for log file

Enter the food name:AAAA

Command Prompt– java orderServiceee X

Enter the food Price: 99

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Command Prompt– java orderServiceee X

Do you wish to have anything else?


If yes press 1 otherwise press 0

Please enter the choice: 9

Command Prompt– java orderServiceee X

Enter the food name: AAAA

Command Prompt– java orderServiceee X

Enter
Command Prompt– theorderServiceee
java food Price: 99 X

Please enter your name: AAAA


Submitted by: Manisha Bhattarai (1801T1090085)
8
C1054 Java Programming

Command Prompt– java orderServiceee X

If you wish to view log file press r


If you do not wish to view log file press anything
Enter the choice:

Output Screen Design


Command Prompt – java orderServiceee X

Menu
Submitted by: Manisha Bhattarai (1801T1090085)
8
C1054 Java Programming

Command Prompt – java orderServiceee X

Bill

Command Prompt – java orderServiceee X

----------------------------------------------------------------------
| THE THEVALUE
CHOICE
YOU ENTERED
YOU
YOU ENTERED
ENTERED
AN EMPTYISISNOT
INVALID!
VALUE
NUMERIC! |
| Submitted by: Manisha Bhattarai | (1801T1090085)
| TRY AGAIN! | 8
----------------------------------------------------------------------
C1054 Java Programming

Command Prompt – java orderServiceee X

LOG FILES
--------------

Bill

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Bill

Program Listing

File name : orderServiceee.java

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;

Submitted by: Manisha Bhattarai (1801T1090085)


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
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<list.size(); i++)


{
String readLine=(String)list.get(i);
String[] splitt=readLine.split("__");
System.out.println("\t"+splitt[0]+"\t"+splitt[1]+"\t"+"\t"+splitt[2]+"\t"+splitt[3]+"\t"+splitt
[4]+"\t"+"\t"+splitt[5]);
}

System.out.println("\r\n"+"\r\n");
}

catch(Exception e)
{
e.printStackTrace();
}

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"+" Type the number present on the right hand side of the
food."+" x");
System.out.println("\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+" x");
System.out.println("\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxx");
System.out.println("\r\n");
}

Submitted by: Manisha Bhattarai (1801T1090085)


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
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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-enter your choce:");
cc=br.readLine();
}

int c=Integer.parseInt(cc);
if(c>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
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
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
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
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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food name:"+" ");
nameInput=br.readLine();
}

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()<=0)
{
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"+" YOU ENTERED AN EMPTY
VALUE!"+"\t"+"\t"+" |");

Submitted by: Manisha Bhattarai (1801T1090085)


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<list.size(); i++)


{
list.get(i);
}

System.out.println("\t"+"\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"Do you wish to have anything else?"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"If yes press 1 otherwise press 0"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x");

Submitted by: Manisha Bhattarai (1801T1090085)


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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Please Re-enter the value:"+" ");
ii=br.readLine();
}

int ss=Integer.parseInt(ii);

Submitted by: Manisha Bhattarai (1801T1090085)


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 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"+"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
C1054 Java Programming

System.out.print("\t"+"\t"+"\t"+"Please enter your name:"+" ");


String name_one=br.readLine();

while(name_one.trim().length()<=0)
{
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"+" 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");

File file_two=new File("text-file//text_2.txt");


OutputStream os_1=new FileOutputStream(file_two);
DataOutputStream dos_two=new DataOutputStream(os_1);
dos_two.writeBytes("\r\n"+"\r\n");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"##########################################
#######");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"DHERAI MITHO KHANEKURA
RESTURANT"+"\t"+"#");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"Naya-Baneshwor, Kathmandu, Nepal"+"\t"+"#");
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"+"Food-Item"+"\t\t"+"Price-RS."+"\t"+"#");
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"+neww+"\t\t\t"+neww1+"\t\t"+"#");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"Total:"+"\t\t\t"+neww1+"\t\t"+"#");
dos_two.writeBytes("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.writeBytes("\t"+"\t"+"#"+"\t"+"-----------------------------"+"\t"+"\t"+"#");

Submitted by: Manisha Bhattarai (1801T1090085)


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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-enter the food name:"+" ");
nameInput_two=br.readLine();
}

String nameInputtt=nameInput_two.toUpperCase();

Submitted by: Manisha Bhattarai (1801T1090085)


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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");
priceInput_two=br.readLine();
}

int priceInputtt=Integer.parseInt(priceInput_two);
if(priceInputtt>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()<=0)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");

Submitted by: Manisha Bhattarai (1801T1090085)


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
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
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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food name:"+" ");
nameInput=br.readLine();

Submitted by: Manisha Bhattarai (1801T1090085)


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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"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);

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

for(int i=0; i<list.size(); i++)


{
list.get(i);
}

System.out.println("\t"+"\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"Do you wish to have anything else?"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"If yes press 1 otherwise press 0"+"\t"+"x");
System.out.println("\t"+"\t"+"x"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"x");
System.out.println("\t"+"\t"+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
x");
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 EnterNamem();
}
}

public int get_choice()


{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("\t"+"\t"+"\t"+"Enter your choice:"+" ");
String ii=br.readLine();

while(ii.trim().length()<=0)
{
System.out.println("\r\n");
System.out.println("\t"+"\t"+" -------------------------------------------------");

Submitted by: Manisha Bhattarai (1801T1090085)


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 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("\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
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()<=0)
{
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"+" 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");

BufferedWriter dos_two = new BufferedWriter(new FileWriter("text-file//text_3.txt",


true));
dos_two.write("\r\n"+"\t"+"\t"+"##############################################
###");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"DHERAI MITHO KHANEKURA
RESTURANT"+"\t"+"#");
dos_two.write("\r\n"+"\t"+"\t"+"#"+"\t"+"\t"+"\t"+"\t"+"\t"+"\t"+"#"+"\r\n");
dos_two.write("\t"+"\t"+"#"+"\t"+"Naya-Baneshwor, Kathmandu, Nepal"+"\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");

Submitted by: Manisha Bhattarai (1801T1090085)


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()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food name:"+" ");
nameInput_two=br.readLine();
}

String nameInputtt=nameInput_two.toUpperCase();
System.out.println("");
System.out.print("\r\n"+"\t"+"\t"+"\t"+"Enter the food Price:"+" ");

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

String priceInput_two=br.readLine();

while(priceInput_two.trim().length()<=0)
{
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"+" 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("\r\n"+"\t"+"\t"+"\t"+"Re-Enter the food Price:"+" ");
priceInput_two=br.readLine();
}

int priceInputtt=Integer.parseInt(priceInput_two);
if(priceInputtt>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()<=0)
{
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"+" YOU ENTERED AN EMPTY
VALUE!"+"\t"+"\t"+" |");

Submitted by: Manisha Bhattarai (1801T1090085)


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
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
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
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<list.size();i++)
{
System.out.println(list.get(i));
}
}

default:
{
System.exit(0);
}
}
}

catch(Exception e)
{
e.printStackTrace();
}
}
}

Program Testing

Test plan

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Test cases Objectives

Submitted by: Manisha Bhattarai (1801T1090085)


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
To 4.
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.
To 13.
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 customer’s 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
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
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
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
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
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
C1054 Java Programming

Test case: 6
Objective: To examine whether food choice accepts a character or not
Test Data: A
Expected Test Error message should appear
Result:
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Test case: 7
To examine whether food choice accepts number greater than 12
or not
Test 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
C1054 Java Programming

Test case: 8
Objective: To examine whether the availability of food is displayed or not
after 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
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
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 appear
Actual Test Result: Error message appeared
Conclusion: The command was executed without any error

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

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

Submitted by: Manisha Bhattarai (1801T1090085)


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
C1054 Java Programming

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

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Test case: 14
Objective: To examine whether 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
C1054 Java Programming

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

Submitted by: Manisha Bhattarai (1801T1090085)


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
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
C1054 Java Programming

Test case: 18
Objective: To examine whether the food price, food name and customer’s
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
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
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
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
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
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
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
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
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
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
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
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
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
C1054 Java Programming

Step 8

If you press 1, type the name of another food item.

Step 9

Submitted by: Manisha Bhattarai (1801T1090085)


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
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
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
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
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
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
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 today’s
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
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 be
deleted 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)


8
C1054 Java Programming

Title: Beginners Java Tutorial

URL address: http://www.roseindia.net/java/beginners/index.shtml

Submitted by: Manisha Bhattarai (1801T1090085)


8
C1054 Java Programming

Turnitin Originality Report

Submitted by: Manisha Bhattarai (1801T1090085)


8

You might also like