联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2021-12-18 10:27

COMP1038 Coursework 02 – Food Order

Management System

Version History

Version 1.4 - 2021-12-10.

Submission

You must submit a single C source code file containing all your code for this exercise.

The files must be called FoodOrderMgntSystem.c . The program must not require any

other files outside of the standard C headers which are always available. The first line

of the C source code file should be a comment which contains your student ID

number, username, and full name, of the form:

// 6512345 zy12345 Joe Blogs

The file must compile without warnings or errors when I use the command

gcc -std=c99 -lm –Wall -g -fsanitize=leak FoodOrderMgntSystem.c -o

FoodOrderMgntSystem

This command will be run on our Linux server cslinux. If it does not compile, for any

reason, then you will lose all the marks for testing (common reasons in the past have

been submitting a file with the wrong filename, or developing your solution on your

personal computer without having tested it on our Linux server). If the file compiles

but has warnings then you will lose some marks for not correcting the warnings.

Plagiarism

You should complete this coursework on your own. Anyone suspected of plagiarism

will be investigated and punished in accordance with the university policy on

plagiarism (see your student handbook and the University Quality Manual). This may

include a mark of zero for this coursework.

You should write the source code required for this assignment yourself. If you use

code from other sources (books, web pages, etc), you should use comments to

acknowledge this (and marks will be heavily adjusted down accordingly). The only

exception to this is the dynamic data structures (linked lists and others) developed

during the lectures and tutorials; you may use these, with or without modification,

without penalty as long as you add a comment in your program saying you have taken

them from the lectures or tutorials and saying how you have modified it (or not

modified it). If you do not acknowledge their source in a comment then it will be

regarded as potential plagiarism.

You must not copy or share source code with other students. You must not work

together on your solution. You can informally talk about higher-level ideas but not to

a level of detail that would allow you all to create the same source code.

Remember, it is quite easy for experienced lecturers to spot plagiarism in source code.

We also have automated tools that can help us identify shared code, even with

modifications designed to hide copying. If you are having problems you should ask

questions rather than plagiarize. If you are not able to complete the exercise then you

should still submit your incomplete program as that will still get you some of the

marks for the parts you have done (but make sure your incomplete solution compiles

and partially runs!).

If I have concerns about submission, I may ask you to come to my office and explain

your work in your own words.

Marking

The marking scheme will be as follows:

? Tests (70%): Your program should correctly implement the task requirements.

A number of tests will be run against your program with different input data

designed to test if this is the case for each individual requirement. The tests

themselves are secret but general examples of the tests might be:

o Does the program work with the example I/O in the question?

o Does the program work with typical valid input?

o Does the program correctly deal with input around boundary values?

o Does the program correctly deal with invalid input (both invalid files and

values)?

o Does the program handle errors with resources not being available (eg,

malloc failing or a filename being wrong)?

o Does the program output match the required format?

o Does the program output an appropriate table when required?

As noted in the submission section, if your program does not compile then

you will lose all testing marks. ? Appropriate use of language features (20%): Your program should use the

appropriate C language features in your solution. You can use any language

features or techniques that you have seen in the course, or you have learned on

your own, as long as they are appropriate for your solution. Examples of this

might be:

o If you have many similar values, are you using arrays (or equivalent)

instead of many individual variables?

o Have you broken your program down into separate functions?

o Are all your function arguments being used?

o If your functions return values, are they being used?

o If you have complex data, are you using structures?

o Are you using loops to avoid repeating many lines of code?

o Are your if/switch statements making a difference, or are the conditions

always true or false making the statement pointless?

o Are you using a dynamic data structure, if required, as per the

specification?

o Are you closing files when the file is no longer in use? ? Source code formatting (10%): Your program should be correctly formatted

and easy to understand by a competent C programmer. This includes, but is not

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.

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

Category no. Name

1 Starter

2 Curries

3 Barbecues

Do you want to explore more categories (y/n)?: n

Food no. Name Price Qty Description

2-1 Chicken curry 150 2 4 pcs boneless chicken with curry

2-2 Fish curry 120 1 2 pcs fish with curry

3-3 Shrimp barbecue 80 2 10 shrimps

Total: 580.00

Do you want to check out (y/n)?: p

Invalid input.

Do you want to check out (y/n)?: n

Do you want to add to the selected food list (y/n)?: n

Do you want to remove from the selected food list (y/n)?: y

Enter the food number you want to remove from the selected list: ghd

Invalid input.

Enter the food number you want to remove from the selected list: 2-2

Food no. Name Price Qty Description

2-1 Chicken curry 150 2 4 pcs boneless chicken with curry

3-3 Shrimp babecue 80 2 10 shrimps

Total: 460.00

Do you want to check out (y/n)?: y

Amount: 460.00

1. Card 2. Cash (1/2)?: a

Invalid input.

1. Card 2. Cash (1/2)?: 1

Enter card number: 12345678912345678

Invalid card number.

Enter card number: 123456789

Enter the card holder’s name: Charlse Babage

Payment unsuccessful.

1. Cancel the order 2. Change payment method (1/2)?: 2

1. Card 2.Cash (1/2)?: 1

Enter card number: 438473847

Enter the card holder’s name: Charlse Babage

Payment successful.

1) Order food

2) Admin section

3) Exit

Option: 2

Enter the password: ********

Invalid password.

1) Order food

2) Admin section

3) Exit

Option: 2

Enter the password: *********

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: s

Unknown option.

Option: 1

Enter a category name: Curries

The category you entered is already on the list.

Enter a category name: Drinks

Successfully created category.

Do you want to add more categories (y/n)? n

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: 2

Enter a category number: 5

Invalid category number.

Enter a category number: 3

Successfully deleted.

Do you want to delete more categories (y/n)? n

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: 3

Category no. Name

1 Starter

2 Curries

4 Drinks

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: 4

Enter a category number: 6

Invalid category number.

Enter a category number: 4

Enter food name: Orange juice

Enter price: 20

Enter availability: 6

Enter a description: 200ml sweet orange juice

Successfully created food record.

Do you want to add more food records (y/n)?: y

Enter a category number: 2

Enter food name: Chicken curry

The food item already exists in the food list in the same category.

Do you want to add more food records (y/n)?: n

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: 5

Enter a category number: 2

Enter a food number: 5

Invalid input.

Enter a food number: 3

Successfully deleted.

Do you want to delete more food items (y/n)?: n

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: 6

Enter a category number: 2

Category name: Curries.

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

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: 7

Enter start date: 21/20/23

Invalid date.

Enter start date: 21/11/23

Enter end date: 21/11/22

Start date must be on or before the end date.

Enter the start date: 21/11/23

Enter the end date: 21/11/24

Table no. Payment method Card no. Card holder’ name Amt. Date Time

10 Card 438473847 Charlse Babage 460.00 21/11/24 18:30:40

Total amount: 460.00

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: 8

Enter the old password: *******

Invalid password.

Do you want to change the password (y/n)?: y

Enter the old password: ******

Enter new password: ****

Password can’t be less than 5 characters and more than 15 characters.

Enter new password: ****************

Password can’t be less than 5 characters and more than 15 characters.

Enter new password: ***********

Enter the new password again: ************

Re-entered new password and new password don’t match.

Enter new password: ***********

Enter the new password again: ***********

Password successfully changed.

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: 9

1) Order food

2) Admin section

3) Exit

Option: 3

Z2019024 $

Notes

You must have efficiently utilized files to store category, food, transaction, and

other information for future execution of the program.

You have to appropriately create, read from, write into, and close files to store

data and process data.

The first time on a new computer the program will run with no previous data

except a pre-determined admin password, which is “admin”. During the

execution of the program, it will store data into the files appropriately and load

the previously stored data from the files during the next executions of the

program.

Few concepts that include, but are not limited to, selection of proper data

structure (s), when to open a file and close a file, how to arrange data inside a

file are implicit within the requirements. You need to understand the

requirements and decide accordingly.

You should create one file for storing category and food information and

another file for storing transaction information. If your program creates more

than two files to manage data, it will lead to a deduction of marks for each file

created, from the total marks. ? You need to close all the open files when they are no longer in use.

Formats for prompts, messages, tables, and menus should be maintained as

described in the specification.

Remember to free any main memory which you no longer need. Your program

should not have any main memory leaks (dynamically allocated areas of

memory that are no longer reachable). You will need to consider how the

responsibility for allocated data transfers as your program runs.

END


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp