Java Lab

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

E-RESTAURANT

E-RESTURANT
INTRODUCTION
The food delivery market is changing at an accelerated pace. And as a restaurant owner, being
online is the way to go when it comes down to expanding your current customer base & boosting
your stream of revenue.

Having an online presence makes you “sparkling visible” to clients who’d otherwise never see an
ad or hear about your business, and who would probably never come knocking on your
restaurant door. So there goes your foot traffic.

However, building an online presence is just like tapping your customers on the shoulder and
story tell them all about your great restaurant.

And when you add to the table an easy-to-use feature, like a customer-friendly online ordering
system for restaurants, then you've just skyrocketed your chances of boosting sales
and increasing your profit margin.

But still, you may ask yourself: “Can’t we just be online without online ordering?” Well yes, yes
you can. But then you’d be missing out on this huge cash-cow opportunity.

And why should you let it slip through your fingers?

Restaurant owners around the world who are racing to capture new customers have already
jumped on board of the online delivering trend.

People have moved on from ordering offline to ordering online because it is easy,
convenient and completely transparent.

They can finally say goodbye to the hustle and bustle generated by the old ways of food
ordering.

This is what they want. So then, why not give the people what they want?

1
E-RESTAURANT

SOURCE CODE:

import java.io.*;

import java.lang.*;

class CustomerOrder

boolean valueset=false;

String str[]=new String[3];

synchronized void d_takeOrder(Thread t)

if(valueset)

try

wait();

}catch(InterruptedException e)

System.out.println(e);

System.out.println("\n"+t);

try

2
E-RESTAURANT

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

for(int i=0;i<3;i++)

System.out.print("\n Take an Order "+(i+1)+" :: ");

str[i]=br.readLine();

}catch(IOException e)

System.out.println(e);

valueset=true;

notify();

synchronized void d_dispOrder(Thread t)

if(!valueset)

try

wait();

}catch(InterruptedException e)

3
E-RESTAURANT

System.out.println(e);

System.out.println("\n"+t);

for(int i=0;i<3;i++)

System.out.print("\n Place an Order "+(i+1)+" :: "+str[i]);

valueset=false;

notify();

class takeOrder implements Runnable

customerOrder d;

Thread t;

takeOrder(customerOrder d)

this.d=d;

t=new Thread(this,"Manager take an order");

t.start();

4
E-RESTAURANT

public void run()

for(int i=0;i<2;i++)

d.d_takeOrder(t);

class dispOrder implements Runnable

customerOrder d;

Thread t;

dispOrder(customerOrder d)

this.d=d;

t=new Thread(this,"Manager place an order");

t.start();

public void run()

for(int i=0;i<2;i++)

d.d_dispOrder(t);

5
E-RESTAURANT

class Restaurant

public static void main(String args[])

customerOrder d=new customerOrder();

new takeOrder(d);

new dispOrder(d);

6
E-RESTAURANT

OUTPUT

Thread[Manager take an order,5,main]

Take an Order 1 :: 2 Roti

Take an Order 2 :: 1 plat Veg.Jaipuri Sabji

Take an Order 3 :: 1 plat Pulav

Thread[Manager place an order,5,main]

Place an Order 1 :: 2 Roti

Place an Order 2 :: 1 plat Veg.Jaipuri Sabji

Place an Order 3 :: 1 plat Pulav

Thread[Manager take an order,5,main]

Take an Order 1 :: 3 Roti

7
E-RESTAURANT

Take an Order 2 :: 1 plat Paneerkadai Sabji

Take an Order 3 :: 1 plat Biriyani

Thread[Manager place an order,5,main]

Place an Order 1 :: 3 Roti

Place an Order 2 :: 1 plat Paneerkadai Sabji

Place an Order 3 :: 1 plat Biriyani

You might also like