limited to, indentation, bracketing, variable/function naming, and use of
comments.
Task
Nowadays, restaurant owners are preferring to use a computerized system to easily
maintain food orders from their customers. As a software professional, your task is to
develop a Food Order Management System software.
When the program runs, it should display the following main menu to the user and
prompt them to enter a menu option:
1) Order food
2) Admin section
3) Exit
Option:
If the user enters the number of an option, the program should perform that option
then return to the main menu to let the user select another option. If the user enters
something which is not a valid option then the program should print "Unknown
option." then print "Option: " again for the user to select another option. The user
may enter any input at this, or any other prompt, in the program, terminated by
pressing the return key (newline character). Your program must deal with this
appropriately, accepting valid input and rejecting invalid input according to the
particular prompt.
If the user selects the “Order food” option, the program will show the prompt “Enter
the table number:”. The customer needs to input a table number, which can vary
from 1 to 100. Providing any input other than integer and an integer outside of the
given range will display an “Invalid table number.” message and show the prompt to
ask the table number again. After input of a valid table number, the program will
show the food category in the following table format sorted ascending order by
category number, and a prompt “Enter the category number:”
Category no. Name
Then the customer needs to input a category number from the above table. If the
customer provides an input rather than a category number from the current category
list, the program will show the message “Invalid category number.” and show the
prompt to ask category number again. If the customer inputs a category number for
which the food list is empty, the program will display the message “Empty food
list.” and show the prompt to ask for a category number again. After entering a valid
category number, the program will display the food items in the corresponding
category in the following table format sorted ascending order by food number and the
prompt “Enter the food number:”. If the customer input a food number which is not
on the table or a food item whose availability is 0, the program will show the message
“Invalid food number.” and show the prompt to ask for the food number again.
Food no. Name Price Availablity Description
The customer needs to input a food number of his/her interesting food from the table.
After entering a valid food number, the program will show the prompt “Enter the
food item’s quantity:”. Valid quantity will be a number that is less than or equal to
the current availability of the food item. For any invalid quantity input, the program
will show the message “Invalid quantity.” and show the prompt to ask the quantity
again. Thereafter, if avalilabity of the food item is not zero, the program will display
the prompt “Do you want to order more food (y/n)?:”. After entering food items
quantity to the prompt “Enter the food item’s quantity:” if availability of the food
item becomes zero, the program will display the category page again. If the customer
enters y/Y, to the prompt “Do you want to order more food (y/n)?:”, the program
will show the “Enter the food number:” and wait for input of another food number. If
the customer inputs the same food number again, the program will display “You have
already selected the food.”. The program will proceed like this until the customer
inputs n/N for the prompt “Do you want to order more food (y/n)?:”. If the
customer inputs n/N, the program displays the category page again. If the customer
provides any other input rather than y/Y or n/N, then the program will display the
message “Invalid input.” and show the prompt to ask the choice (y/n) again. After
returning to the category page from the food selection page, the program will display
the category table again and thereafter the prompt “Do you want to explore more
categories (y/n)?:”. If the customer enters y/Y, the program will display the prompt
to ask category number. After input of category number, the program will display the
food selection page according to that category. The program will proceed like this
until the customer inputs n/N for the prompt “Do you want to explore more
categories (y/n)?:”. If the customer inputs n/N, the program will display the
selected food list in the following table format sorted ascending order by category
number and food number. Food numbers will be in XXX-XXX format. First XXX is
the category number and second XXX is the selected food number in the category.
Any input apart from y/Y or n/N to the prompt “Do you want to explore more
categories (y/n)?:” will show the message “Invalid input.”.
Food no. Name Price Qty Description
Total: XXXX.XX
Below the table, the program will display the total price of the selected foods. Below
the total price, the program will display the prompt “Do you want to check out
(y/n)?:” If the customer inputs y/Y, the program will display the payment page. If the
customer inputs n/N, the program will show the prompt “Do you want to add to the
selected food list (y/n)?:”. For any other input, the program will display “Invalid
input.”. If the customer inputs y/Y to the prompt Do you want to add to the
selected food list (y/n)?:, the program will display the category page again. If the
customer inputs n/N, the program will show the prompt “Do you want to remove from
the selected food list (y/n)?:”. If the customer inputs y/Y, the program will show
the prompt “Enter the food number you want to remove from the selected list:”.
If the customer inputs a food number from the selected food list, the program will
display the updated selected food list and updated total price and the sequence of
prompts and messages as in the selected food list page. If the food number the
customer inputs to the prompt “Enter the food number you want to remove from the
selected list:” is not in the selected food list table, the program will show the
message “Invalid food number.” and show the prompt to ask the food number again.
If the customer inputs n/N to the prompt “Do you want to remove from the selected
food list (y/n)?:”, the program will go to the payment page. In both the prompts
“Do you want to add to the selected food list (y/n)?:” and “Do you want to
remove from the selected food list (y/n)?:”, if the customer provides any input
rather than y/Y or n/N, the program will display “Invalid input.” and show the
prompt again.
Operations on the payment page will be performed by the waiter. On the payment
page, the program will display the total amount of the order at the beginning. Then it
will show the prompt “1. Card 2. Cash (1/2)?:”. The waiter needs to input 1/2 based
on the customer’s payment method. Any input other than 1/2 will show the message
“Invalid input.” and show the prompt “1. Card 2. Cash (1/2)?:” to ask the
payment method again. If the waiter inputs 1, the program will show the prompt
“Enter card number:”. Card number is a 9 digit number. If the waiter inputs any value
apart from a number and more than 9 characters, the program will display “Invalid
card number.”. After inputting a valid card number, the program will show the prompt
“Enter the card holder’s name:”. The name can be a maximum of 50 characters
long. If the waiter inputs a name of more than 50 characters, the program will display
the message “Input name is more than 50 characters.”. If the waiter press enters
without any input, the program will display “Invalid input.”. If the waiter chooses
the cash option (2), he/she will collect the total money from the customer and press
enter button. After entering name to the prompt “Enter the card holder's name:” in
the card option and pressing enter after selecting the cash option, the program will
display “Payment successful.” if the following information in the table can be saved
in a file, otherwise, the program will display a message “Payment unsuccessful.”. If
payment is successful, the program will display the main menu, and deduct the
ordered quantity from the availability of the ordered foods. If payment is
unsuccessful, the program will show the prompt “1. Cancel order 2. Change payment
method (1/2)?:”. The waiter needs to input 1/2 based on the customer’s decision. Any
input other than 1/2 will show the message “Invalid input.” and show the prompt
“1. Cancel the order 2. Change payment method (1/2)?:” to ask the customer’s
decision again. If the waiter inputs 1, the program will display the main menu, the
order will be canceled, and the availability of the foods will not change. If the waiter
chooses option 2, the program will show the prompt “1. Card 2. Cash (1/2)?:” and
follow the subsequent steps for payment.
Description Type Size Remarks
Table no. Integer 1-100
Amount Float total amount
Card/cash Character 1 Character 1/2
Card no. String 9 Characters it will be blank in case of ‘cash’
Card name String 50 Characters it will be blank in case of ‘cash’
Amount Float Total amount of the order
Date String 8 Characters store current system date (yy:mm:dd)
Time String 8 Characters Store current system time (hh:mm:ss)
in 24 hr format
Only the restaurant manager has the authority to enter into the “Admin section” option
of the main menu as he/she knows the password. On the main menu, if the restaurant
manager selects the option for “Admin section”, the program will show the prompt
“Enter the password:”. The manager needs to input a pre-determined password.
Initially, this password is “admin” until the manager changes this password. The
program will perform a match of the input password with the password stored in the
file. If the password doesn’t match, the program will show “Invalid password.” and
display the main menu below. If the password matches, the program will show the
following menu. Please keep in mind that you must keep the initial password of the
admin section as “admin” in lower case, otherwise, we can’t test your admin section
and you will lose half of the marks allocated for testing.
1. Add a category
2. Delete a category
3. View categories
4. Add a food item
5. Delete a food item
6. View food items
7. Show transaction history
8. Change password
9. Exit
Option:
If the user enters the number of an option from this menu under the “Admin
section”, the program should perform that option then return to this menu to let the
user select another option. If the user enters something which is not a valid option
then the program should print "Unknown option." then print "Option: " again for the
user to select another option. The user may enter any input at this, or any other
prompt, in the program, return to the main menu by pressing the return key (newline
character).
If the manager selects the “Add a category” option, the program will show the prompt
“Enter a category name:”. The category name is a 50 characters string. If the
manager press enters without the input of any string, the program will show a message
“Invalid input.” and show the prompt “Enter a category name:” again. If the
manager inputs a category name which is more than 50 characters, the program will
show the message “Category name can’t be more than 50 characters.” and show
the prompt “Enter a category name:” again. If the category name the manager
entered is already in the category list the program will show the message “The
category you entered is already on the list.” and show the prompt “Enter a
category name:” again. After entering a valid category name, the following data in the
table will be stored in the file. If the records are successfully saved in the file, the
program will show the message “Successfully created category.”. If due to some
reason, the program can’t store the records in the file, the program will show the
message “Category creation unsuccessful.”. In both cases, thereafter, the program
will show the prompt “Do you want to add more categories (y/n)?:”. If the manager
inputs y/Y the program will show the prompt “Enter a category name:” again and
ask for a category name. If the manager enters n/N, the program will show the menu
in the “Admin section”. Any other input apart from y/Y or n/N will show the message
“Invalid input.” and show the prompt again.
Description Type Size Remarks
Category no Integer Will start from 1 and automatically
calculate and assign the current
category no. the next available
number in a category no. list.
Name string 50 characters
If the manager selects the option “Delete a category”, the program will show the
prompt “Enter a category number:”. If the manager enters a valid category number
from the list, the program will remove records of the category along with the food
items associated with that category from the file. If the manager inputs any value as a
category number, which is not in the current category list, the program will display
“Invalid category number.”. If category list is empty, after selecting the “Delete a
category”, the program will show a message "Empty category list." and thereafter
display the menu under "Admin section". After entering valid category number with
non-empty category list, if the records are successfully deleted from the file, the
program will show a message “Successfully deleted.”. If due to some reason, the
program can’t delete the records from the file the program will show the message
“Unsuccessful deletion.”. In both cases, thereafter, the program will show the
prompt “Do you want to delete more categories (y/n)?:”. If the manager inputs
y/Y, the program will show the prompt “Enter a category number:” again to ask a
category number. If the manager inputs n/N, the program will display the menu under
the “Admin section”. Any other input apart from y/Y or n/N will show the message
“Invalid input.” and show the prompt again.
If the manager selects the “View categories” option for the menu, the program will
display the current category list from the file in the following table format sorted
ascending order by category number. Thereafter, the program will display the menu
under the “Admin section”.
Category no. Name
If the manager selects the “Add a food item” from the menu, the program will show
the prompt “Enter a category number:”. The manager should input a category
number from the current list stored in the file. For any other input, the program will
show the message “Invalid category number.” and show the prompt to ask the
category number again. After entering a valid category number, the program will
show the prompts to enter food name, price, availability, and description and store
these data in the file along with the food number using the format given in the
following table. Food numbers will start from 1 and the current food number will be
the next available food number in the food numbers list. Food numbers of two foods
can’t be the same in a category but can be the same in different categories. Providing
inputs in any other type of data format apart from the following table will show the
message “Invalid input.” and show the prompt to ask for the data again. After
entering valid inputs, the program checks if a food name is already there in a food list
under the category. If the food name already exists, the program will display a
message “The food item already exists in the food list in the same category.”.
Description Type Size Remarks
Food no Integer Will start from 1 and automatically
calculate and assign the current
food no. the next available
number in a food number list.
Name string 20 characters
Price float price of a food item
Availability integer Number of available dishes of
food item
Description string 50 characters
After entering valid data for a food item, if the record is successfully saved in the file,
the program will show the message “Successfully created food record.”. If due to
some reason, the program can’t store the records in the file, the program will show the
message “Food record creation unsuccessful.”. In all the food items already exist,
successful food record creation, unsuccessful food record creation cases, thereafter,
the program will show the prompt “Do you want to add more food records (y/n)?:”.
If the manager inputs y/Y the program will show the prompts to ask for data for a new
food item again. If the manager enters n/N, the program will show the menu in the
“Admin section”. Any other input apart from y/Y or n/N will show the message
“Invalid input.” and show the prompt again.
If the manager selects the option “Delete a food item”, the program will show the
prompt “Enter a category number:”. If the manager enters a valid category number
from the current category list, the program will show the prompt “Enter a food
number:”. If the manager inputs a food number from the current food list in the file
under the input category, the program will remove the record of the food item from
the file. If the manager inputs any value as a category number, which is not in the
current category list and any value for the food number which is not in the current
food list in the corresponding category, the program will display “Invalid input.”
after the corresponding prompts and show the prompt to ask the input again. If
category list is empty, after selecting the “Delete a food item” option, the program
will show a message "Empty category list." and thereafter display the menu under
"Admin section". If category list is not empty, after entering a valid category number
from the category list to the prompt “Enter a category number:”, if food list under
the category is empty, the program will show a message "Empty food list." and
thereafter display the menu under "Admin section". After entering valid category
number with non-empty category list and food item list, if the records are successfully
deleted from the file, the program will show the message “Successfully deleted.”. If
due to some reason, the program can’t delete the records from the file the program
will show the message “Unsuccessful deletion.”. In both cases, thereafter, the
program will show the prompt “Do you want to delete more food items (y/n)?:”. If
the manager inputs y/Y, the program will show the prompt to ask for the category
number and food number again. If the manager inputs n/N, the program will display
the menu under the “Admin section”. Any other input apart from y/Y or n/N will show
the message “Invalid input.” and show the prompt again.
If the manager selects the “View food items” option from the “Admin section” menu,
the program will show the prompt “Enter a category number:”. Any input rather
than category numbers in the current category list will show the message “Invalid
category.”. If the manager inputs a valid category number, the program will display
the food item list from the file under the input category in the following table format
sorted ascending order by food number and with the category name. Thereafter, the
program will display the menu under the “Admin section”.
Category name: XXXXX
Food no. Name Price Description
If the manager selects the “Show transaction history” option from the menu, the
program will show the prompt “Enter the start date:”. After entering the start date,
the program will show the prompt “Enter the end date:”. After entering the end
date, the program will display the transactions within the start and end date including
both the dates in the following table format sorted ascending order by date and the
total amount of the transactions below the table.
Table no. Payment method Card no. Card holder’s name Amt. Date Time
Total amount: XXX.XX
In the table, the payment method column will show either card or cash based on the
actual payment method used in the transaction. The start date and end date will be in
yy/mm/dd format and the start date will be before the end date. If the start date and
end date do not follow the above format and are not valid dates, the program will
show the message “Invalid date.” after the corresponding input of dates and show
the prompt to ask the date again. After entering the end date if the start date is not the
same or before the end date, the program will display the message “Start date must
be on or before the end date.” and show the prompts to ask the dates again. After
displaying the transaction history table, the program will display the menu under the
“admin section”.
If the manager selects the “Change password” option, the program will show the
prompt “Enter the old password:”. After entering the old password, the program will
match the password with the password stored in the file. If the password matches with
the stored password in the file, the program will show the prompt “Enter new
password:”. Password will be 5-15 characters long. If the manager inputs a password
of fewer than 5 characters and more than 15 characters, the program will display the
message “Password can’t be less than 5 characters and more than 15
characters.” and show the prompt to ask for the new password again. If the old
password doesn’t match with the password stored in the file, the program will display
the message “Invalid password.” and show the prompt “Do you want to change the
password (y/n)?”. If the manager inputs y/Y, the program will show the prompts to
ask old password and a new password again. If input the old password matched with
the stored password and the new password is in a valid form, the program will display
the prompt “Enter the new password again:”. If the new password and re-entered
new password don’t match Program will show the message “Re-entered new password
and new password don’t match.” and thereafter show the prompts to ask for a new
password and re-enter the new password again. If re-entered new password and new
password match, the program will display the message “Password successfully
changed.” and the old password in the file will be replaced by the new password. If
the manager inputs n/N, to the prompt “Do you want to change the password
(y/n)?:” or the program shows the message “Password successfully changed.”, in
both the cases thereafter the program will show the menu under the “admin section”.
Any other input apart from y/Y or n/N in the prompt “Do you want to change the
password (y/n)?:” will show the message “Invalid input” and show the prompt
again. While entering old, new, and re-entering the new passwords, the program will
replace actual characters using ‘*’ on screen for non-visibility to others.
If the manager selects the “Exit” option under the admin section, the program will
show the main menu.
If the manager or the customer selects the “Exit” option in the main menu, the
program will terminate from execution.
Strict output format guideline
We may test your program through some automated testing software. So your output will strictly
follow the following formats. Otherwise, tests may fail and you will lose marks from the marks
allocated for testing.
All the input prompts, messages, menu options, and table headers will be as per the
specification.
There will be NO line gap in options in a menu.
If the manager selects the “Change password” option, the program will show the
prompt “Enter the old password:”. After entering the old password, the program will
match the password with the password stored in the file. If the password matches with
the stored password in the file, the program will show the prompt “Enter new
password:”. Password will be 5-15 characters long. If the manager inputs a password
of fewer than 5 characters and more than 15 characters, the program will display the
message “Password can’t be less than 5 characters and more than 15
characters.” and show the prompt to ask for the new password again. If the old
password doesn’t match with the password stored in the file, the program will display
the message “Invalid password.” and show the prompt “Do you want to change the
password (y/n)?”. If the manager inputs y/Y, the program will show the prompts to
ask old password and a new password again. If input the old password matched with
the stored password and the new password is in a valid form, the program will display
the prompt “Enter the new password again:”. If the new password and re-entered
new password don’t match Program will show the message “Re-entered new password
and new password don’t match.” and thereafter show the prompts to ask for a new
password and re-enter the new password again. If re-entered new password and new
password match, the program will display the message “Password successfully
changed.” and the old password in the file will be replaced by the new password. If
the manager inputs n/N, to the prompt “Do you want to change the password
(y/n)?:” or the program shows the message “Password successfully changed.”, in
both the cases thereafter the program will show the menu under the “admin section”.
Any other input apart from y/Y or n/N in the prompt “Do you want to change the
password (y/n)?:” will show the message “Invalid input” and show the prompt
again. While entering old, new, and re-entering the new passwords, the program will
replace actual characters using ‘*’ on screen for non-visibility to others.
If the manager selects the “Exit” option under the admin section, the program will
show the main menu.
If the manager or the customer selects the “Exit” option in the main menu, the
program will terminate from execution.
Strict output format guideline
We may test your program through some automated testing software. So your output will strictly
follow the following formats. Otherwise, tests may fail and you will lose marks from the marks
allocated for testing.
All the input prompts, messages, menu options, and table headers will be as per the
specification.
There will be NO line gap in options in a menu.
There will be NO dot (‘.’) at the end of options in a menu.
There will be ONE line gap between input prompts, messages, a prompt and a message,
an input prompt/message and first option in a menu, last option in a menu and an input
prompt/message, an input prompt/message and table header, last line in a table and an
input prompt/message, table header/last row in a table and first/last option in a menu.
There will be ONE line gap between the table header and the first row of table data.
Two consecutive columns in a table will be separated by a tab.
Each message will be ended by dot (‘.’).
Each input prompt will be ended with a colon (‘:’).
In each input prompt, there will be a character gap between the end of the prompt with a
colon (‘:’) and actual input.
There will be NO dot (‘.’) at the end of the output statements ending with a number (eg.
Total: XXX.XX, Category no.: XXXX)
Amounts will be displayed till TWO decimal values after the decimal point.
Information which need to store in file must be stored only in two files: 1. ‘menu.csv’ for
category and food related information and 2. ‘transaction.csv’ for transaction related
information. Password will store in transaction.csv file.
Example input/output
1) Order food
2) Admin section
3) Exit
Option: 1
Enter the table number: 1000
Invalid table number.
Enter the table number: 10
Category no. Name
1 Starter
2 Curries
3 Barbecues
Enter the category number: 5
Invalid category number.
Enter the category number: 2
Food no. Name Price Availability Description
1 Chicken curry 150 5 4 pcs boneless
chicken with curry
2 Fish curry 120 6 2 pcs fish with curry
3 Egg curry 80 8 One boiled egg with
Curry
Enter the food number: 6
Invalid food number.
Enter the food number: 1
Enter the food item’s quantity: 6
Invalid quantity.
Enter the food item’s quantity: 2
Do you want to order more food (y/n)?: g
Invalid input.
Do you want to order more food (y/n)?: y
Enter the food number: 2
Enter the food item’s quantity: 1
Do you want to order more food (y/n)?: n
Category no. Name
1 Starter
2 Curries
3 Barbecues
Do you want to explore more categories (y/n)?: f
Invalid input.
Do you want to explore more categories (y/n)?: y
Enter the category number: 3
Food no. Name Price Availability Description
1 Chicken barbecue 130 5 4 pcs boneless
chicken
2 Fish barbecue 120 6 2 pcs fish
3 Shrimp barbecue 80 8 10 shrimps
Enter the food number: 3
Enter the food item’s quantity: 2
Do you want to order more food (y/n)?: n