0% found this document useful (0 votes)
7 views

COMPUTER SCIENCE UNIT 2 Internal Asessment

The document outlines an internal assessment for a Fast Food Ticket System designed to streamline order collection and payment processing at a restaurant owned by Ms. Ann. It includes a problem statement detailing the challenges faced due to increased customer flow, an interview with Ms. Ann to gather insights, and a feasibility study assessing technical, economic, and operational aspects of the proposed system. The program will be developed in C and aims to enhance efficiency, accuracy, and customer satisfaction by automating order management and receipt generation.

Uploaded by

editorrizzy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

COMPUTER SCIENCE UNIT 2 Internal Asessment

The document outlines an internal assessment for a Fast Food Ticket System designed to streamline order collection and payment processing at a restaurant owned by Ms. Ann. It includes a problem statement detailing the challenges faced due to increased customer flow, an interview with Ms. Ann to gather insights, and a feasibility study assessing technical, economic, and operational aspects of the proposed system. The program will be developed in C and aims to enhance efficiency, accuracy, and customer satisfaction by automating order management and receipt generation.

Uploaded by

editorrizzy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 43

COMPUTER SCIENCE UNIT 1

INTERNAL ASSESSMENT

Name of Candidate: Jawayne Giscombe


Name of Centre: Kingston College
Center Number: 100057
Candidate Number: 100057
Name of Teacher: Floyd Powell
Year of Examination: 2024/2025
Territory: Jamaica
Topic: A Program that collects people’s orders by prompting the person to choose what they
want to buy, and the amount they want, and calculating the total price of what they ordered.
Title: Fast Food Ticket System

1 | Page
Table of Contents
Table of Contents..........................................................................................................................2
INTRODUCTION............................................................................................................................3
Problem Statement...........................................................................................................................4
Observation.....................................................................................................................................5
Interview.........................................................................................................................................6
Feasibility Study.............................................................................................................................7
FUNCTIONAL REQUIREMENTS.................................................................................................10
Non-Functional Requirements.........................................................................................................10
Pseudocode....................................................................................................................................11
Narrative.......................................................................................................................................15
USE OF FILE................................................................................................................................16
Description of file inputs and outputs...............................................................................................18
Test Plan......................................................................................................................................21
Test Results.................................................................................................................................23
Use of Appropriate Data Structures.............................................................................................26
Demonstration of structured programming concepts..........................................................................27
System Architect............................................................................................................................27
Context Diagram............................................................................................................................30
Level 1 Diagram...........................................................................................................................31
User Documentation.......................................................................................................................32
Coding of Program......................................................................................................................34

2 | Page
INTRODUCTION

In this Internal Assessment, I will be creating a program that collects people’s orders by
prompting the person to choose what they want to buy, and the amount they want, and
calculating the total price of what they ordered. This program can be useful as it is an
organized and quick way to give persons a food ticket and the total. Although this method
is widely used, my program can still be useful, for example, in schools that have not
utilized this method yet. A system like this may prove extremely efficient, and the code
will be written in the C programming language.
The program will prompt the user to enter the amount of money and their food and drink
of choice. The program will then use the cost of each of the food items they entered, and
calculate the total cost, printing a ticket which contains the food items, The amount
purchased, the change and ticket number.
I will be creating a test plan, as well as explaining each part of the code in detail and what
it is supposed to do, with screenshot evidence of it doing so.

3 | Page
Problem Statement

Ann-Marie Baker, otherwise known as Ms. Ann, is the local owner of a food restaurant in the
community of Waterford.

The small restaurant had a total staff of 5 people including Ann-Marie. At the start of 2023, Ms.
Ann did not have many customers, so the ordering system in her restaurant was not an issue, and
errors were minimal. However, in the later part of 2023, with the introduction of TikTok, Ms.
Ann made a post showcasing her delicious meals, which gained massive popularity across
Jamaica. As a result, her restaurant experienced a significant surge in customers.

With more customers came more work, and it quickly became too much for her to handle alone.
Many errors occurred, not only in calculations but also in managing the queue for food orders,
storing data, and tracking credit and debit book entries.

The Fast-Food Ticket System aims to streamline the process of collecting customer orders by
developing a program that prompts individuals to select their desired items and specify the
quantity. The system must accurately calculate the total cost of the order based on the selected
items and quantities, then correctly determine the change amount. Additionally, it should
generate an order receipt that includes the change amount, the total payment received, an order
number, and the time of the order.

The challenge lies in designing a user interface that ensures smooth interaction while
maintaining precise price calculations. Efficiency and accuracy are paramount to enhancing the
overall customer experience and optimizing operational workflows for the fast-food
establishment.

Customers place one or many orders. Orders contain one or many menus’ items. Each Order is
processed by one staff member, but a staff member can handle many orders. Menu Items have
one or many price entries Payments will be linked to orders, capturing total payment received,
change given, and timestamps.

4 | Page
Observation
In February 2024, I visited Ms. Ann’s restaurant to ask her how the change had affected her. She
expressed that she was feeling stressed due to the overwhelming workload. I then inquired about her
previous and current system (which has remained unchanged).

The manual system that Ms. Ann used, both in the past and present, was as follows:

1. A customer would approach and ask about the menu.

2. Either she or a staff member would browse the menu selection and provide the details.

3. They would check whether the requested item was available.

4. The customer would then be asked how much money they had.

5. Payment would be validated or declined based on the order and amount of money.

6. Two identical random numbers would be written. One for the food box and the other for the
customer.

7. The requested order details would then be completed.

8. Efforts would be made to maintain order while serving the food.

9. Orders would be recorded in a logbook to track transactions for balance sheet purposes.

10. The customer’s number would be called out. If they had the corresponding ticket, they would
give it and receive their food. The ticket would then be discarded.

She then requested that I create a computer system that would accurately calculate the total cost
of an order based on the selected items and quantities, then correctly determine the change
amount. She also wanted it to generate a file containing an order receipt, which would include
the change amount, the total payment received, an order number, and the time of the order. This
file would serve as an aid for logbook markups. She also wanted to edit the order before it was
completed in the file.

5 | Page
Interview
The interview aims to gather details and insights into the work ethic and challenges faced by Ms. Ann in
managing her small restaurant's increased customer flow and some information on the previous system.
By understanding the current ordering process, common errors, and desired improvements, we can
develop an efficient Fast-Food Ticket System tailored to her needs. The questions focus on identifying
inefficiencies in order management, payment processing, and customer queue handling, while I explore
potential features that would enhance accuracy and the streamline operations. The information collected
will be crucial in designing a user-friendly system that improves Ms. Ann’s workflow and overall
customer experience.

General Business Questions:


1. Can you tell me a little about your restaurant and how it has evolved over the past year?
Answer: My restaurant is a small, family-run fast-food spot in Waterford. When I started, it was
just me and four other staff members. We served mostly locals, and things were steady but slow.
However, since my TikTok video showcasing our meals went viral, business has boomed. We
now get a lot more foot traffic, and we even see customers coming from other towns. It's been a
blessing, but also a bit overwhelming.
2. What changes did you notice in your customer flow after your TikTok post went viral?
Answer: There was a huge spike in the number of customers. Before, we’d maybe get 20–30
orders a day. Now, on busy days, we’re pushing over 100. The lines are longer, orders come in
quicker, and it’s harder to keep track of everything manually like we used to.

Current Ordering System & Challenges:


3. How are customer orders currently taken and processed?
Answer: Right now, we write orders down on paper slips and calculate totals using a calculator.
It’s very hands-on and leaves a lot of room for mistakes, especially when we’re rushed.
4. What are the most common errors that occur in the ordering and payment process?
Answer: The biggest issues are wrong orders, incorrect totals, and giving the wrong amount of
change. Sometimes we even forget to note down if someone paid or took something on credit. It
can get messy fast.
5. How do you currently track orders, customer payments, and outstanding balances on the
credit/debit book?
Answer: We use a physical notebook to record who owes what, and another one to track
payments and orders. It’s all manual, so sometimes we misplace entries or forget to update things
properly.
6. What difficulties have you encountered in managing the queue of customers during peak hours?
Answer: The line gets long quickly, and people get frustrated waiting. There’s no proper system
to manage who ordered first, so sometimes orders get mixed up. We also struggle to serve
customers fast enough without sacrificing accuracy.
7. How do you calculate totals, change, and receipts? Do you use any software or is it all done
manually?

6 | Page
Answer: Everything is done manually. We use a calculator for totals and change, and we
handwrite receipts. It’s not very efficient, and it slows us down during busy hours.
Desired Features for the New System:
8. What specific features would you like in a digital ordering system to help improve efficiency?
Answer: I’d love to have a system that automatically calculates totals and changes, prints
receipts, and helps track orders. A queue management feature would also be helpful. It would be
even better if it could store customer and credit info.
9. Would you prefer a touchscreen system, a mobile app, or a computer-based system for placing
orders? A touchscreen system would be great. Something simple and easy to use for both staff
and maybe even customers in the future.
Answers:
10. Do you need a system that allows customers to place orders themselves, or should it remain staff-
operated?
Answer: For now, I think it should be staff-operated. But if the system could support self-service
in the future, that would be a great option to grow into.
11. How important is it for the system to store past orders for reference?
Answer: Very important. Being able to see what customers ordered before, or quickly find
repeated orders, would save a lot of time and reduce confusion.
12. Would you like the system to track inventory, so you know when certain ingredients are running
low?
Answer: Yes, absolutely. We often run out of key ingredients without realizing it, so having
inventory tracking would help us plan better.
Payment & Receipt Management:
13. How do customers typically pay? cash, debit/credit card, or mobile payments?
Answer: Mostly cash, but we’re seeing more customers using cards and mobile payments now,
especially the younger crowd.
14. Do you have any issues with calculating or handling change during busy periods?
Answer: Yes, when things get hectic, it's easy to miscount change or forget how much someone
gave us. A system that helps with that would be a big help.
15. What details do you want included on the receipt? (e.g., order number, time, itemized list, total
cost, payment received, change, etc.)
Answer: I'd like the receipt to show the order number, time, itemized list of what was ordered,
total cost, how much the customer paid, and the change given.
Implementation & Future Goals:
16. Are you open to training your staff on how to use the new system?
Answer: Definitely. If the system is easy to understand, I’m sure my staff will adapt quickly. I’m
happy to train them.
17. Would you like the system to generate reports on sales, popular menu items, or customer trends?
Answer: Yes, that would be very useful. I’d love to know which items are selling best and how
much we’re making each day or week.
18. Do you foresee any challenges in integrating a digital system into your current workflow?
Answer: Maybe at first, especially with staff getting used to it. But I believe once we get the hang
of it, things will be much smoother than before.

7 | Page
19. What would success look like to you once the new system is in place?
Answer: If the new system can help us take orders faster, reduce errors, manage payments easily,
and keep better records, I’ll consider it a success. If my customers are happier and the staff less
stressed, that’s even better.
20. Is there anything else you’d like to share that could help us design the best system for your
restaurant?
Answer: If the new system can help us take orders faster, reduce errors, manage payments easily,
and keep better records, I’ll consider it a success. If my customers are happier and the staff less
stressed, that’s even better.

8 | Page
Feasibility Study
1. Technical Feasibility
The proposed system involves developing a program that collects customer orders, calculates
the total cost, determines the change, and generates an order receipt. The system will be
developed using the C programming language, ensuring compatibility with Ms. Ann's current
hardware and the environment.

System Requirements:

 Hardware: The program can be run on any computer system with basic hardware, such
as a simple desktop or laptop with a keyboard, monitor, and printer for generating
receipts. Ms. Ann’s current hardware should be capable of handling the program, as it
does not require high processing power.
 Software: The C programming language will be used to write the application. Basic
knowledge of C (including handling inputs, performing calculations, and file I/O for
storing receipts) is sufficient for developing the system. The system could also be
adapted to other programming languages such as Python or Java if scalability becomes
a concern in the future.
 Database/Storage: The program will store data (order information) in files or a simple
local database (e.g., SQLite or a flat file). Ms. Ann’s restaurant does not require an
extensive cloud database system, and a local database would suffice for now.
 Integration: The system could integrate with a basic POS (Point of Sale) terminal if
needed, ensuring ease of order processing. However, an initial standalone system could
work without needing POS integration.
 UI/UX Design: The user interface (UI) will be simple and text-based, providing prompts
for customers to select their items and quantities. The UI design should be
straightforward to use by both customers and staff. The system will also feature error-
handling functions to ensure that invalid inputs (e.g., incorrect amounts) do not crash
into the program.
 Given that the project is small in scale, with limited complexity, the technical feasibility is
high. Ms. Ann's business operations can easily integrate the system, and her current
infrastructure is adequate to meet the software requirements.

2. Economic Feasibility
Cost of Development:

 Development Time: The system will take approximately 3-4 weeks to develop, including
coding, testing, and debugging.
 Developer's Fee: Assuming a reasonable hourly rate of $500 per hour for a developer,
and an estimated 120 hours of development time, the total cost would be approximately
$60,000.

9 | Page
 Equipment: Ms. Ann may already have the necessary hardware (a simple computer and
printer). If not, additional costs could arise, such as purchasing a basic desktop or laptop
(around $30,000 - $50,000 for a functional system), and a printer (around $25,000 -
$35,000).
 Maintenance: After the system is set up, the maintenance costs should be minimal. The
program should require periodic updates for bug fixes and enhancements, which could
cost $10,000 - $50,000 annually depending on the complexity of the issues.

Revenue Impact:

 Time Savings: With an automated system, Ms. Ann can reduce the time spent on
manual calculations and writing receipts. This could lead to faster service, allowing more
customers to be served during peak hours, potentially increasing revenue.
 Reduction in Errors: The system will minimize errors in calculations and order
management, which could improve customer satisfaction and reduce the need for
refunds or corrections.
 Operational Efficiency: The system's automated order tracking will allow Ms. Ann to
handle a larger volume of customers more effectively, optimizing the overall workflow.

Cost-Benefit Analysis: The cost of developing and implementing the system is relatively low
when compared to the potential benefits, such as increased efficiency and reduced human
error. Over time, Ms. Ann could see a return on investment through improved customer
satisfaction, increased sales, and reduced operational costs.

3. Operational Feasibility
Staff Training:

 The system will require some basic training for Ms. Ann and her staff. Since the user
interface is simple, with clear prompts and instructions, training should take no more
than a few hours.
 The staff needs to learn how to input orders, process payments, and generate receipts.
This will require them to become familiar with the basic operations of the system.

Operational Integration:

 The system will integrate smoothly into Ms. Ann’s daily operations. Once the program is
running, customers can place their orders directly through the system, speeding up the
process and reducing the strain on Ms. Ann and her staff.
 The program will automatically calculate the total, generate change, and create an order
receipt. This will streamline the service and reduce the time spent manually processing
payments.

User Acceptance:

10 | Page
 Ms. Ann has requested the system, and the manual system currently in use has proven
to be inefficient. Therefore, there is a strong willingness to adopt the new system. Her
staff, however, may need a transition period to become accustomed to the new way of
handling orders. However, the simplicity of the program should minimize any resistance
to change.
 Customers will not experience significant changes in the ordering process except for the
speed and accuracy with which they receive their orders.
Scalability:

 The system is designed to handle a moderate number of orders per day. If the
restaurant experiences a significant increase in customers, the system may need to be
scaled, either by improving the software’s performance (e.g., optimizing the code) or
integrating with a larger POS system.
Data Security:

 Since the system will store order and payment data, it’s important to ensure basic
security measures are in place. For instance, user data should not be stored unless
necessary (e.g., no credit card information), and order data should be protected from
unauthorized access.

11 | Page
FUNCTIONAL REQUIREMENTS
This program must be able to:

 Item Selection & Quantity Input – The system shall allow customers or staff to select
multiple menu items and specify quantities before confirming the order.
 Order Cost Calculation – The system shall accurately compute the total cost based on
selected items and their prices.
 Change Calculation – The system shall correctly calculate and display the change amount
after receiving payment.
 Receipt Generation – The system shall generate a receipt that includes:
Order number
Total cost
Payment received
Change amount
Order timestamp
 • Receipt Storage – The system shall store the receipt file for record-keeping and
logbook markups.
 • Error Handling & Validation – The system shall prevent incorrect inputs, such as
negative quantities or non-numeric payments, and provide clear error messages.
 • Order Modification – Before finalizing an order, users shall have the ability to remove
or adjust item quantities.
 • User Interface Responsiveness – The system shall display real-time updates as items
are added or removed, ensuring smooth interaction.
 Error Handling – The system shall provide appropriate error messages for invalid inputs,
such as insufficient payment, incorrect item selection, or system errors.

Non-Functional Requirements
The program must be:

Performance & Efficiency


Response Time – The system shall process orders and generate receipts within 2 seconds.
Concurrency – The system shall handle at least 500 transactions per hour without performance
degradation.
Optimized Workflows – The system shall minimize the number of steps required to complete an
order to enhance cashier efficiency.
Usability & User Experience

12 | Page
Ease of Use – The system shall have an intuitive interface that cashiers can learn in under 30
minutes.
Error Prevention – The system shall provide a specific number to finalize an order to prevent
accidental transactions.
Accuracy & Reliability
Calculation Precision – The system shall ensure accurate cost and change calculations up to two
decimal places.
System Uptime – The system shall be available 99.9% of the time to prevent service disruptions.
Data Integrity – The system shall prevent unauthorized modification of stored receipts and order
records.
Security & Compliance
Audit Logs – The system shall maintain a log of all transactions for security and accountability
purposes.
Data Privacy – The system shall comply with relevant data protection regulations to ensure
customer payment details are not stored improperly.
Scalability & Maintainability
Scalability – The system shall be capable of expanding to support additional registers and
locations without significant performance degradation.
Maintainability – The system shall allow easy updates for menu items and prices.
Backup & Recovery – The system shall automatically back up receipt files and transaction logs
daily to prevent data loss.

Pseudocode

13 | Page
DEFINE CONSTANT MAX_ITEMS = 15
DEFINE CONSTANT MAX_NAME_LENGTH
DEFINE CONSTANT MAX_INPUT_LENGTH

STRUCT MenuItem:
name[MAX_NAME_LENGTH]
price: float

STRUCT Order:
quantities[MAX_ITEMS] // quantity of each item ordered
totalCost: float
payment: float

DECLARE menu[MAX_ITEMS] as array of MenuItem


INITIALIZE menu with predefined items and prices

FUNCTION sortMenu():
SORT menu alphabetically by name

FUNCTION displayMenu():
FOR each item in menu:
DISPLAY item number, name, and price

FUNCTION searchMenu():
PROMPT user to enter item name
READ search input
FOR each item in menu:
IF item name matches search input (case-insensitive):
DISPLAY item name and price
RETURN
DISPLAY "Item not found"

FUNCTION displayCurrentOrder(order):
DISPLAY items and quantities selected from order
DISPLAY total cost

FUNCTION updateItemQuantity(order):
PROMPT user for item number
PROMPT user for new quantity
UPDATE quantity in order
14 | Page
UPDATE total cost

FUNCTION removeItem(order):
PROMPT user for item number to remove
SET corresponding quantity to 0
RECALCULATE total cost

FUNCTION generateOrderNumber():
RETURN random 4-digit number

FUNCTION generateReceipt(order):
GENERATE order number
GET current timestamp
CREATE or open receipt file (e.g., "receipt.txt")
WRITE order number, date/time, items, prices, total, payment, and change
CLOSE file
DISPLAY "Receipt saved"

MAIN PROGRAM:
CALL sortMenu()

WHILE true:
CREATE new Order object and initialize all values to 0

LOOP:
CALL displayMenu()
DISPLAY extra options: 16. Search, 17. Display Order, 18. Update, 19. Remove, 0.
Finish

PROMPT user for choice


READ user input

IF choice == 0:
BREAK loop

IF choice == 16:
CALL searchMenu()
CONTINUE

IF choice == 17:
CALL displayCurrentOrder(order)
15 | Page
CONTINUE

IF choice == 18:
CALL updateItemQuantity(order)
CONTINUE

IF choice == 19:
CALL removeItem(order)
CONTINUE

IF choice is between 1 and MAX_ITEMS:


PROMPT for quantity
ADD quantity to order
UPDATE total cost

IF order.totalCost == 0:
DISPLAY "No items selected. Returning to menu."
CONTINUE

DISPLAY total cost


PROMPT for payment
STORE payment in order.payment

IF payment < totalCost:


PROMPT again until valid

DISPLAY change
CALL generateReceipt(order)
DISPLAY "Thank you!"

PROMPT "Would you like to make another order? (Y/N)"


IF user enters 'N' or 'n':
BREAK

Narrative

16 | Page
The program begins by initializing a menu of 15 food items, each with a corresponding price,
and sorting them alphabetically for easier navigation. It then presents the customer with the
menu, allowing them to select items by entering the corresponding item numbers. If the customer
wishes to check the availability of a specific item, they can use the search function to find it by
name. After selecting an item, the customer is prompted to enter the desired quantity, ensuring
that only valid positive integers are accepted. The program keeps track of the total cost as items
are added. Once the customer chooses to complete their order, the program calculates the total
cost and prompts the customer to enter a payment amount. If the payment is insufficient, the
program repeatedly asks for a valid amount until it meets or exceeds the total cost. After
processing the payment, the program generates a unique four-digit order number and saves a
detailed receipt, including the purchased items, their quantities, time,the total cost, the payment
amount, and the change, to a file named "receipt.txt". If there is an issue with saving the receipt,
an error message is displayed. Finally, the program confirms the successful completion of the
transaction and thanks the customer for their order.

17 | Page
USE OF FILE
The use of the text file receipt.txt within the program is to keep track of customer orders by
generating a personalized receipt containing details such as the items ordered, their prices, the
total cost, the amount paid, the change, and a unique order number. This receipt serves as a
record for both the customer and the business, ensuring accuracy in transactions. Since the file is
opened in write mode, the data is temporarily stored, meaning each new transaction overwrites
the previous receipt.
The advantages of using a file for storing receipts include:
 Easy Accessibility – The receipt file can be opened and read by any text editor, such as
Notepad or Microsoft Word, allowing customers and business owners to review past
orders.
 Efficiency and Organization – Instead of relying solely on on-screen messages, having a
saved file provides a structured way to store order details, making it easier to reference or
print the receipt if needed.
 Error Prevention – By saving the order information in a file, discrepancies in transactions
can be minimized, ensuring customers receive accurate receipts for their purchases.
By integrating file handling, the program enhances user experience by offering a tangible record
of transactions while maintaining a simple and efficient approach to order management.

18 | Page
Description of file inputs and outputs
File Input and Output in the Fast-Food Ordering System
Alright, let's break down how file input and output are handled in this Fast-Food Ordering
System and why they matter!

File Input:
Prompting for Input:

The program prompts the user with messages like "Select an option:" and "Enter quantity:" when
ordering food.
User Input:

The user selects an item by entering a number corresponding to the menu item.
After selecting an item, they enter the quantity they want to order.
The program also prompts for payment amount when finalizing the order.
Reading Input:

The program reads user input using scanf, ensuring it only accepts valid numbers.
If invalid input is detected (like entering a letter instead of a number), it clears the input buffer
and asks again.
Validation:

The system checks whether the selected menu item is within the correct range (1 to 15).
It also ensures that the quantity is a valid positive integer.
When accepting payment, the system ensures that the user enters enough to cover the total cost.
Usage in the Program:

The selected items and their quantities are stored in an array.


The total cost is calculated and displayed before asking for payment.
If the user doesn’t enter enough money, they’re asked to enter a new amount until it meets the
total.
File Output:
Opening the File:

 The program opens a file named "receipt.txt" in write mode ("w").


 If the file fails to open, it displays "Error saving receipt!" to inform the user.
Writing Order Details Header:

19 | Page
 Once the file is open, the program writes a receipt header to make the information clear
and structured.
 The header includes:

Writing Item Details:

 For every item the user ordered, the program writes its name, quantity, and total price in a
neat format:

Writing Total Cost and Payment Details:

 After listing the items, the program writes the total cost, amount paid, and change:

Writing Order Number and Timestamp:

 A random 4-digit order number is generated and written to the file.


 The current date and time are also recorded using ctime(&t) so customers can have a
timestamp of their purchase.
Closing the File:
 Once everything is written, the program closes the file to make sure all data is saved
properly.
 It then prints "Receipt saved as receipt.txt" to let the user know their receipt is ready!

Why Use Files?

20 | Page
Using receipt.txt in the system provides a structured and permanent way to track orders. Some
key benefits include:

 Easy Access – The receipt can be opened by any text editor, allowing both customers and
staff to review orders.
 Error Prevention – Helps reduce mistakes in transactions by keeping a record of the exact
items and amounts paid.
 Business Tracking – Even though the file overwrites with each new order, it ensures that
every completed transaction is logged properly.

21 | Page
Test Plan
1.Normal Data
Variable Test Data Purpose Expected Results
Name
menu[] 1. Burger $450.00, 2. Valid menu items Program displays all
Fries $230.00, 3. with prices for menu items correctly.
Soda $150.00, etc. selection.
quantities {2, 1, 3, 0, 0, 2, 1, 0, A valid array of item Correct total cost
0, 0, 0, 0, 1, 0, 1} quantities selected by calculation based on
the user. user’s selections.
payment 2000.00 Valid payment Correct change
amount (sufficient to calculation and
cover the order). receipt generation.
totalCost 1760.00 Total cost of the Correct total cost
order, based on the displayed
selected menu items.

2.Erroneous Data
Variable Test Data Purpose Expected Results
Name
choice 20 Invalid menu choice Program should show
(out of bounds). an "Invalid choice"
message and prompt
again.
qty -2 Invalid quantity Program should
(negative number). prompt for valid
input
payment 1000.00 Payment is less than Program should reject
the total cost. the invalid quantity
and ask for a valid
input.
quantities[] {5, 0, 0, -1, 0, 2, 3, 0, Invalid quantity Program should reject
0, 0, 0, 0, 2, 0, 0} (negative value). the invalid quantity
and ask for a valid
input.

3.Extreme Data
Variable Test Data Purpose Expected Results
Name
choice 1 (Menu choice A valid menu choice Program should
within valid range) (test boundary). accept the input and
proceed.
qty 10 Extreme valid Program should
quantity (maximum handle the large

22 | Page
allowable items per quantity and calculate
selection). total cost correctly.
payment 1000000.00 Extreme payment Correct change
value (much greater should be calculated
than total cost). and the receipt should
print correctly.
quantities[] {10, 10, 10, 10, 10, Extreme case: Program should
10, 10, 10, 10, 10, 10, maximum quantities handle large inputs
10, 10, 10, 10} for each item. without crashing and
calculate total cost
correctly.

4.Incomplete Data
Variable Test Data Purpose Expected Results
Name
choice 0 User selects "Finish Program should show
Order" without a message like "No
selecting any items. items selected.
Exiting." and
terminate gracefully.
qty 0 User selects a valid Program should
menu item but enters prompt the user to
zero as quantity. enter a valid quantity
greater than zero.
payment 0.00 User enters zero as Program should ask
payment amount, less the user for a valid
than the total cost. payment greater than
the total cost.

23 | Page
Test Results

Normal:

Screenshot 1

Screenshot 2

Screenshot 3

Screenshot 4

Screenshot 5

Erroneous:
Screenshot 7

Screenshot 8

Screenshot 9

24 | Page
Screenshot 10

Screenshot 11

Screenshot 12

Extreme

Screenshot 13

Screenshot 14

Screenshot 15

25 | Page
Screenshot 16

Screenshot 17

Incomplete

Screenshot 18

Screenshot 19

26 | Page
Use of Appropriate Data Structures

MenuItem struct
This struct represents each item in the menu.
It contains the following fields:
name[MAX_NAME_LENGTH]: A character array used to store the name of the menu item.
price: A float representing the price of the item.
The MenuItem struct allows for organized storage of menu data and easy access by index.
It enables sorting, displaying, and searching through menu items efficiently.

• Order struct
This struct tracks all relevant data for a single order placed by a customer.
It contains:
quantities[MAX_ITEMS]: An array of integers representing how many of each menu item were
ordered.
totalCost: A float that stores the computed total cost of the order.
payment: A float for the amount paid by the customer.
The Order struct encapsulates all the necessary details about a transaction, enabling clean
receipt generation and modular logic.

• menu[MAX_ITEMS] array
This is an array of MenuItem structs that holds the complete menu.
It allows the program to:
Loop through items for display.
Search or sort the menu.
Retrieve item prices and names easily when calculating orders.
Having the menu as a structured array makes it efficient to manage and scale.

• money_input[MAX_INPUT_LENGTH] character array


This buffer stores user input when entering payment.
Since user input is initially a string, money_input allows for safe collection and later conversion
using atof() (ASCII to float).
This structure ensures input validation and protects against invalid or malformed entries.

27 | Page
Demonstration of structured programming concepts

System Architect

1. User Interface (UI):


- Responsible for interacting with the user, displaying the menu, and taking inputs such as the
amount of money and quantities of items to order.

2. Menu Management:
- Responsible for storing the menu items and their prices.
- Provides functions to display the menu.

3. Order Management:
- Responsible for managing the user's order, including storing the quantities of items selected
by the user and calculating the total price.

4. File Handling:
- Responsible for writing order details to a file, including the items ordered, total price, time of
order, change, and order number.

5. Random Number Generation:


- Responsible for generating a random order number.

System Architecture:

User Interface <--> Menu Management <--> Order Management <--> File Handling <-->
Random Number Generation

User Interface (UI):


- Displays the menu to the user.
- Takes user input for amount of money in possession.
- Takes user input for the quantities of items to order.
- Handles error messages related to user input.

Menu Management:
- Stores the menu items and their prices.

28 | Page
- Provides a function to display the menu.

Order Management:
- Manages the user's order by storing the quantities of items selected.
- Calculates the total price of the order.
- Validates the user's order against available funds.

File Handling:
- Writes order details to a file, including items ordered, total price, change, and order number.
- Handles errors related to file operations.

Random Number Generation:


- Generates a random order number for each order.

Structure Chart
Main
└── User Interface
├── Display Menu
├── Get Money Input
├── Get Item Quantities
│ └── Validate Quantity
├── Calculate Total
│ └── Validate Total
├── Check Funds
├── Generate Order Number
├── Write Order Details to File
└── Error Handling

29 | Page
Structure chart

30 | Page
Entity Relationship Diagram

31 | Page
Context Diagram

32 | Page
Level 1 Diagram

33 | Page
User Documentation

User Documentation
Installing the software
Dev-C++ requirements
Dev-C++ requires Windows. You need about 9 megabytes for the download file and 60.
megabytes more for the installed IDE.
System Requirements For DEV-C++ For Window 10
• Operating System: Windows XP/Vista/7/8/8.1/10
• Memory (RAM): 2 GB of RAM required.
• Hard Disk Space: 500 MB of free space required.
• Processor: 1.0 GHz Intel Pentium processor or later.
• NET 4.5 Framework Required
1. Download Dev-c++ from the official website https://www.bloodshed.net
2. Run the setup.exe program
3. Choose the appropriate language
4. Agree with the license agreement
5. Select next when prompted with choose components
6. The destination folder for the program will by default be C:\Program Files (x86) \Dev-Cpp
(The destination can be changed by the user if wanted)
7. The space required for version 5.11 is 346.8 mb
8. After meeting the requirements select install to install the program, wait patiently until all
the files are extracted.
9. After the files are extracted, a message will come up saying the program has been installed
On your computer, select the finish to run the program.
10. First time configuration prompts will be asked and answer to your preference
Running the program
Running the Program:

1. Preparation: Before running the program, it's recommended to watch a tutorial video on how
to use Dev-C++ for basic understanding.

Apologies for the confusion. Let's revise the user documentation to correspond with your
provided code:

Running the Program:

Before beginning create a folder in “C:” called “temp”

34 | Page
1. Opening and Executing the Program:
- Open the source file of the program.
- Compile and run the program using your preferred compiler.
- The program will start executing.

2. Order Placement:
- Upon execution, the program will prompt the user to input the amount of money they have.
- Enter the amount of money, ensuring it is a valid non-negative integer.
- After entering the money amount, the program will display the menu with various food items
and their prices.
- Enter the quantity of each item you wish to order, ensuring it is between 0 and 10.
- The program will calculate the total price of the order and display it along with the change (if
any).
- A random order number will be generated and displayed.
- The details of the order, including quantities, item names, total price, change, and order
number, will be saved to a file named "receipt.txt" in the same directory as the program.

3. Error Handling:
- If the entered money amount is not a valid non-negative integer, an error message will be
displayed, prompting the user to enter a valid amount.
- If the quantity of any item selected is not within the range of 0 to 10, an error message will be
shown, and the user will be prompted to enter a valid quantity.

4. Exiting the Program:


- After completing the order placement process, the program will ask if you want to make
another order if you choose “n” the program will close.

Note: For any issues or further assistance, please refer to the source code or contact the
program's developer.
Contact Information: For any assistance or queries, you can contact us at 876-875-0110 or via
email at [email protected]@gmail.com.

35 | Page
Coding of Program
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#ifdef _WIN32
#include <direct.h>
#endif

#define MAX_ITEMS 15

// Structure to hold menu items


typedef struct {
char name[30];
float price;
} MenuItem;

// Menu items (unsorted; will be sorted alphabetically on startup)


MenuItem menu[MAX_ITEMS] = {
{"Burger", 450.0},
{"Fries", 230.0},
{"Soda", 150.0},
{"Pizza Slice", 300.0},
{"Salad", 520.0},
{"Box Food Small Fry Chicken", 600.0},
{"Box Food Medium Fry Chicken", 750.0},
{"Box Food Large Fry Chicken", 900.0},
{"Box Food Small Curry Chicken", 700.0},
{"Box Food Medium Curry Mutton", 900.0},
{"Box Food Large Curry Mutton", 1050.0},
{"Box Food Small Stew Pork", 650.0},
{"Box Food Medium Stew Pork", 700.0},
{"Box Food Large Stew Pork", 950.0},
{"Water", 100.0},
};

// Generates a unique 4-digit order number


int generateOrderNumber() {

36 | Page
return rand() % 9000 + 1000;
}

// Saves the receipt to an absolute path file ("C:\\Temp\\receipt.txt") and opens it in


Notepad.
void generateReceipt(int quantities[], float totalCost, float payment) {
int orderNumber = generateOrderNumber();
time_t t;
time(&t);

// Use an absolute file path


const char *filepath = "C:\\Temp\\receipt.txt";
FILE *file = fopen(filepath, "w");
if (file == NULL) {
perror("Error saving receipt");
return;
}

fprintf(file, "===============================\n");
fprintf(file, " FAST-FOOD ORDER RECEIPT\n");
fprintf(file, " Order No: %d\n", orderNumber);
fprintf(file, " Time: %s", ctime(&t));
fprintf(file, "===============================\n");
for (int i = 0; i < MAX_ITEMS; i++) {
if (quantities[i] > 0) {
fprintf(file, "%-25s x%d $%.2f\n", menu[i].name, quantities[i], menu[i].price *
quantities[i]);
}
}
fprintf(file, "-------------------------------\n");
fprintf(file, "Total: $%.2f\n", totalCost);
fprintf(file, "Paid: $%.2f\n", payment);
fprintf(file, "Change: $%.2f\n", payment - totalCost);
fprintf(file, "===============================\n");

if (fclose(file) == EOF) {
perror("Error closing the receipt file");
} else {
printf("Receipt saved as %s\n", filepath);
}

37 | Page
// Open receipt.txt in Notepad on Windows.
#ifdef _WIN32
system("notepad C:\\Temp\\receipt.txt");
#endif
}

// Sorts the menu alphabetically by item name


void sortMenu() {
for (int i = 0; i < MAX_ITEMS - 1; i++) {
for (int j = i + 1; j < MAX_ITEMS; j++) {
if (strcasecmp(menu[i].name, menu[j].name) > 0) {
MenuItem temp = menu[i];
menu[i] = menu[j];
menu[j] = temp;
}
}
}
}

// Displays the full menu (only used when adding items)


void displayFullMenu() {
printf("\n----- Full Menu -----\n");
for (int i = 0; i < MAX_ITEMS; i++) {
printf("%2d. %-30s $%.2f\n", i + 1, menu[i].name, menu[i].price);
}
printf("---------------------\n");
}

// Displays only the current order (only items that have been selected)
void displayCurrentOrder(int quantities[]) {
int empty = 1;
printf("\n***** Current Order *****\n");
for (int i = 0; i < MAX_ITEMS; i++) {
if (quantities[i] > 0) {
printf("%2d. %-30s Quantity: %d, Subtotal: $%.2f\n",
i + 1, menu[i].name, quantities[i], menu[i].price * quantities[i]);
empty = 0;
}
}
if (empty) {
printf("No items in your current order.\n");
38 | Page
}
printf("**************************\n");
}

// Allows the user to search the menu by item name.


void searchMenu() {
char searchItem[30];
int found = 0;

printf("Enter an item to search: ");


getchar(); // consume leftover newline
fgets(searchItem, sizeof(searchItem), stdin);
searchItem[strcspn(searchItem, "\n")] = '\0'; // remove newline

for (int i = 0; i < MAX_ITEMS; i++) {


if (strcasecmp(menu[i].name, searchItem) == 0) {
printf("'%s' is available for $%.2f\n", menu[i].name, menu[i].price);
found = 1;
break;
}
}
if (!found) {
printf("Item not found in the menu.\n");
}
}

// Adds an item to the order.


void addItem(int quantities[], float *totalCost) {
displayFullMenu();
int choice, qty;
printf("Select an item by number (0 to cancel): ");
if (scanf("%d", &choice) != 1) {
printf("Invalid input.\n");
while (getchar() != '\n'); // clear buffer
return;
}
if (choice == 0)
return;
if (choice < 1 || choice > MAX_ITEMS) {
printf("Invalid item selection.\n");
return;

39 | Page
}
printf("Enter quantity: ");
if (scanf("%d", &qty) != 1 || qty <= 0) {
printf("Invalid quantity.\n");
while (getchar() != '\n');
return;
}
quantities[choice - 1] += qty;
*totalCost += menu[choice - 1].price * qty;
printf("Added %d x %s to your order.\n", qty, menu[choice - 1].name);
}

// Removes an item from the order completely.


void removeItem(int quantities[], float *totalCost) {
displayCurrentOrder(quantities);
printf("Enter the item number to remove (0 to cancel): ");
int index;
if (scanf("%d", &index) != 1) {
printf("Invalid input.\n");
while (getchar() != '\n');
return;
}
if (index == 0)
return;
if (index < 1 || index > MAX_ITEMS || quantities[index - 1] == 0) {
printf("Invalid item selection.\n");
return;
}
*totalCost -= menu[index - 1].price * quantities[index - 1];
quantities[index - 1] = 0;
printf("Item removed from your order.\n");
}

// Updates the quantity of an already added item.


void updateItemQuantity(int quantities[], float *totalCost) {
displayCurrentOrder(quantities);
printf("Enter the item number to update (0 to cancel): ");
int index;
if (scanf("%d", &index) != 1) {
printf("Invalid input.\n");
while(getchar() != '\n');
40 | Page
return;
}
if (index == 0)
return;
if (index < 1 || index > MAX_ITEMS || quantities[index - 1] == 0) {
printf("Invalid item selection.\n");
return;
}
int newQty;
*totalCost -= menu[index - 1].price * quantities[index - 1];
printf("Enter new quantity (enter 0 to remove item): ");
if (scanf("%d", &newQty) != 1 || newQty < 0) {
printf("Invalid quantity.\n");
while(getchar() != '\n');
return;
}
if (newQty == 0) {
quantities[index - 1] = 0;
printf("Item removed from your order.\n");
} else {
quantities[index - 1] = newQty;
*totalCost += menu[index - 1].price * newQty;
printf("Quantity updated.\n");
}
}

int main() {
int continueSession = 1;
srand(time(0));
sortMenu(); // Sort the menu once at startup

// Optional: Print working directory for debugging (Windows version)


#ifdef _WIN32
char cwd[256];
if (_getcwd(cwd, sizeof(cwd)) != NULL) {
printf("Current working directory: %s\n", cwd);
}
#endif

printf("Welcome to the Fast-Food Order System!\n");

41 | Page
while (continueSession) {
int quantities[MAX_ITEMS] = {0};
float totalCost = 0.0, payment = 0.0;
char option;
int orderInProgress = 1;

printf("\n----- New Order -----\n");


while (orderInProgress) {
printf("\nSelect an option:\n");
printf(" a - Add item\n");
printf(" r - Remove item\n");
printf(" u - Update item quantity\n");
printf(" d - Display current order\n");
printf(" s - Search for an item\n");
printf(" f - Finish order\n");
printf("Choice: ");
scanf(" %c", &option);
option = tolower(option);

switch(option) {
case 'a':
addItem(quantities, &totalCost);
break;
case 'r':
removeItem(quantities, &totalCost);
break;
case 'u':
updateItemQuantity(quantities, &totalCost);
break;
case 'd':
displayCurrentOrder(quantities);
break;
case 's':
searchMenu();
break;
case 'f':
orderInProgress = 0;
break;
default:
printf("Invalid option. Please try again.\n");
}
42 | Page
}

if (totalCost == 0) {
printf("No items were added. Order cancelled.\n");
} else {
printf("\nTotal cost: $%.2f\n", totalCost);
while (1) {
printf("Enter payment amount: ");
if (scanf("%f", &payment) != 1 || payment < totalCost) {
printf("Invalid amount. Payment must be at least $%.2f\n", totalCost);
while(getchar() != '\n');
} else {
break;
}
}
printf("Change: $%.2f\n", payment - totalCost);
generateReceipt(quantities, totalCost, payment);
}

printf("\nDo you want to place another order? (y/n): ");


char ans;
while(getchar() != '\n'); // Clear input buffer
ans = getchar();
if (tolower(ans) != 'y') {
continueSession = 0;
}
}

printf("Thank you for using the Fast-Food Order System!\n");


return 0;
}

43 | Page

You might also like