You are on page 1of 1

File Handling

Consider a scenario of online food delivery system having following attributes:

Order id (int)
Customer name (String)
Quantity (int)
Order Time (String) e.g 12:45 p.m
Food Type (String) , Consider following types: Chinese, Desi, FastFood

Use constructor to set values of all attributes.

Design a menu based program with following options:

1. Press ‘C’ for customer


2. Press ‘A’ for admin
(For char input, use next().charAt(0) function)

If user pressed ‘C’, give following options:

1. Press 1 to place Order


e.g: write data like:
101, ali_khan, 2, 12:45 p.m, FastFood

2. Press 2 to give reviews.( For reviews, use txt file and write one or two lines as
review in file) (Function should be static)

If user pressed ‘A’, give following options:

1. Press 1 to view all orders


2. Press 2 to count all orders (To implement this, just read file and use counter
variable inside while loop to find how many times loop is running, which in return
gives you total no of orders).
3. Press 3 to view records where food type is “Chinese”
4. Press 4 to read reviews

(All the above four functions should be static)

You might also like