Fundamentals in Programming.: Gehan Chamod Adikari
Fundamentals in Programming.: Gehan Chamod Adikari
Programming.
Gehan chamod Adikari
CL/HDCSE/93/56
Assignment Cover Sheet
Learner declaration
Marks Awarded
First assessor
IV marks
Agreed grade
1
FEEDBACK FORM
INTERNATIONAL COLLEGE OF BUSINESS & TECHNOLOGY
Module : CSE 4002
Student :
Assessor : Vindya Karunarathne
Assignment : FP
This assignment is worth 100% of the overall assessment for this module.
2
Learning outcomes covered
LO1. Explain structured programming concepts
LO2. Design a basic structured computer program
LO3. Developed a modularized computer programme for a prepared design
LO4. Compile software testing and documentation
Scenario
BestMeal is a newly built Meal kit restaurant situated in west London. This restaurant is
famous for their consistently excellent recipes with quality ingredients.
Responding to rapid customer growth, management has decided automate the entire business
process. Initial step BPA (business process automation) team have analyzed the business
process and planned to automate the Meal kit ordering process.
Assume that you are a group member of BestMeal business process automation team.
Design and develop the Meal kit-ordering module for BestMeal Restaurant automation.
Main requirements
Manage available Meal kits
View available Meal kits.
Search specific Meal kit.
Other requirements are.
User login.
Logout.
Exit
Help
Carefully investigate the given scenario and provide the proposed solution.Attach
softcopy of error free program with your documentation.Keep all the backups
3
TASKS
4
Acknowledgement
This research was supported by the International College of Business & Technology (ICBT).
I would like to express my deepest gratitude to my lecturer, Miss Vindya Karunarathne, who
assisted and guided throughout this assignment. Special thanks should also go to my parents
and all the colleagues of my batch for sharing information.
Thank you,
(CL/HDCSE/93/56).
5
Contents
Acknowledgment
Introduction
Contents
Task 01
1.1 Introduction to programming
1.2 Programming Methodologies
1.3 Controlling Structures
1.4 Modularization
1.5 Library Functions
1.5 User Defined Functions
Task 02
2.1 Requirements gathering techniques
2.2 System Requirements Specification document for Pharmacy Automated Billing
System
2.3 Flow chart diagram
2.4 Pseudocodes for above diagrams
Task 03
3.1 Code Explanation
3.2 Repetition and controlling structures
Task 04
4.1 Test plan
4.2 Test cases
References
6
Task 01
1.1 Introduction to Programming
7
divided into small entities called objects, as there are ways of data hiding it becomes more
secure. These Can solve any complex programs, while providing more chances of reusability
and less function dependency. Object Oriented Programming also supports inheritance,
encapsulation, abstraction, polymorphism.
Abstraction
This concept shows only the necessary things, here you don’t want to show how you have
implemented some function.
Encapsulation
Encapsulation is the mechanism of hiding of information implementation by restricting
admission to public methods. Instance variables are saved private and accessor
techniques are made public to obtain this.
Inheritance
8
Polymorphism
A programming language's potential to process objects in another way relying on their
data type or class.
Selection Structures.
Repetition Structures.
o IF Statement
o IF else
o Nested else if
o Switch Case
IF Statement
This statement helps you to control the flow of your program, by taking decisions on which
code to perform. This statement permits you to control if a program enters a section of code
or not based on a given condition is true or false. Thus it allows the program to choose an
action based upon the user's input.
9
IF else
When there is a situation and you need to perform a block of code if condition is true and
perform another piece of code if the same condition is false. This can be done in C++ using
the if-else statement.
Nested else if
10
When there is an if statement inside another if statement then it is called the nested else if
statement.
Switch Case
This statement is used when we have multiple conditions and need to execute dissimilar
action based on the condition. When we have multiple conditions and we have to perform a
block of statements when a certain condition is fulfilled. In this event case we use an easy
method called switch case.
11
1.3.2 Repetition Structures
For Loop
Until the needed conditions are fulfilled, a for loop is used to execute a block of statements.
Refer the below example-
When displaying number 1-10 you may want to set the value of a variable to 1 and display it
10 times, increasing its value by 1 on each loop iteration.
12
While Loop
Here, until the condition returns false it is evaluated to check if it’s true. When condition
returns false, the control comes out of loop and jumps to the next statement in the program
after while loop. The Combining interactive data entry with the repetition capabilities of the
while statement produces very adaptable and powerful programs.
Do while loop
The condition gets evaluated after the statement inside the loop is executed if the condition
returns true then the control goes to the “do” more recurrent execution of it, this will
happen recurrently till the condition returns false. As soon as the condition returns
false control jumps to the next statement in the program after do-while.
13
1.4 Modularization.
Modular programming or modularization is the technique of subdividing a PC software into
separate sub-programs to amplify the maintainability, readability of the code and to make
the application available to make any modifications in future or to rectify the errors.
The Standard Function Library in C++ is what keeps you from having to rewrite even the
easiest of programming instructions. It is like a big library of sub-libraries, each that consists
the underlying code for several functions. In order to make use of these libraries, you link to
each library in the broader library through the use of header files.
14
Functions Description Examples
iostream Input and output function. Controls for input and output
15
Task 02
2.1 Requirements gathering techniques.
To gather requirements for this billing application I have implemented the process of
distributing close ended type questionnaire among the daily customers that visit the restaurant
and the employees that work in Best Meal restaurant. They’re supposed to reach the
questions and tick the answer that they think is most suitable,
16
2.2 System Requirements specification document
for Restaurant Automated Billing System.
2.2.1 Introduction
Best Meal is a newly built Meal kit restaurant situated in west London. This restaurant is
famous for their consistently excellent recipes with quality ingredients.
Responding to rapid customer growth, management has decided automate the entire business
process. This restaurant system should be made in order to automate the previously manually
done processes of viewing available meal kit, Manage available Meal kits , Search specific
Meal kit.
In which I identified, its inability to modify data, it further failed to be user friendly, which
would lead to a difficulty in reports generation. This would provide more levy for
Mathematical and human errors and will also result in loads of paper work and loss of
information. It further showed an inability of sharing data. Moreover, did not support in
decision making. Due to the above reasons we have decided to go ahead with a restaurant
automated billing system as it will help to collect and analyze all the data that is entered into
the system by the cashier and it will print an automatic bill for the meal kit that the customer
will purchase.
2.2.3 Scope
17
2.2.4 Functional Requirements.
All the features required in a system in order to not be destined to disappoint the customer’s
basic requirements. This is the complete collection of both the functional and non-functional
requirements. Typically, functional requirements are the basic behavior of a system, its main
features and functions.
Usability Requirement
• The system will enable the employees to get to the system from a PC
application which will be used as an interface, no extraordinary training is
required since all employees know about the general use of PC
applications. The system is easy to use which makes the system simple.
18
• In order to make it user friendly include guiding messages to certain
function which will allow the user to do the functionality properly by
minimizing the errors which can occur in the functions of software.
Availability Requirement
• The system available for the employees except to give offers. The system
shall be operational 14 hours a day and 7 days a week.
Efficiency Requirement
• In terms of efficiency as this is a command line- based system it has a high
efficiency which allows the user to work quickly with the system. And in
order to maximize performance do not include time delays in the software.
Accuracy
• The system should accurately provide real time information taking into
consideration various concurrency issues.
• In order to ensure accuracy, we have only allowed the administrator to
perform the changing of entries which is used to provide information to the
customers, so the information provided by the system will be accurate
according to the data given by the administration.
Reliability
• In order to establish reliability, measures should be taken to prevent
crashing of the software which in turn will increase reliability.
19
2.3 Flow chart diagram
2.3.1 Login for admin account
20
2.3.2 Login for cashier account
21
2.3.3 View items for cashier
22
2.3.4 View item for admin
23
2.3.5 Add item for admin
24
2.3.6 Exit function for admin
25
2.3.7 Exit function for cashier
26
2.3.8 Select and print payment bill for cashier account
27
2.4 Psudocodes for above diagrams
Begin
String productname, pprice
Create ‘csv’ file named “meds.csv”
Enter PRODUCTNAME and PRODUCTPRICE as header
If read row ‘yes’
Display data from the ‘csv’ file
Else
Stop
28
Begin
Open ‘csv’ file “Rest.csv”
String productname, pprice
Enter PRODUCTNAME and PRODUCTPRICE as header
Add entered data to the csv file
Display “Item added successfully”
Stop
Begin
Enter username and password
If username and password correct
If yes
Display “Welcome Admin!”
Display admin account interface
Else
Display “Invalid username or password”
Stop
Begin
Enter username and password
If username and password correct
If yes
Display “Welcome Cashier!”
Display cashier account interface
Else
Display “Invalid username or password”
Stop
29
2.4.6 Exit for admin account
Begin
Enter Yes/No
If Yes
Close system
Else
Return to admin menu
Stop
Begin
Enter Yes/No
If Yes
Close system
Else
Return to cashier menu
Stop
30
Task 03
3.1 Code Explanation
3.1.1 Login function
Administrator of the restaurant and the cashier of the restaurant can enter this system. They
have separate passwords and accounts with unique features. The cashier can only select meal
kit and print a bill for the customer while the admin can add new food to the system as well.
31
3.1.2 View items
The cashier and the admin both have the facility of viewing the products. These products are
saved in a comma separated file while is extracted from an excel sheet. This function is
useful for the administrator to see his products at one glance and also helps the cashier to
view the items before printing the bill.
32
3.1.3 Select and print bill
The cashier has get admission to print the price bill. All he/she has to do is to add
the specific product code from the list, and the item will mechanically appear on screen.
Then entering the required quantity of the product and the system will subsequently calculate
the sub total.
33
3.1.4 Exit
Here the administrator and the cashier wants to exit the application they can use this function.
They can confirm if they want to exit or not by typing either “yes” or “no”
34
3.2 Repetition and controlling structures.
3.2.1 Switch case conditions
Switch case statement is used when we have multiple conditions and we need to execute a
block of statements when a particular condition is satisfied.
Ex- view items, log out and exit is printed from 1-4
35
3.2.2 Do while and If-else conditions
36
Task 04
4.1Test Plan
Test Case ID Test Case Name Scenario Result
Test 01 Admin login function Enter correct with Show the Admin
password login interface to the
user
Test 03 1st function in admin Display the list of Show all Meal Kits
login Meal Kit to admin
Test 05 3rd function in admin Logout from admin Logout from the
login account admin account
Test 07 1st function in admin Enter invalid number Show error message
login
Test 08 2nd function in admin Enter invalid number Show error message
login
37
Test 09 3rd function in admin Enter invalid number Show error message
login
Test 10 New Meal Kit no Entering the new Show enter meal kit
meal kit no no message
Test 11 New meal kit Entering the new Show enter meal kit
quantity meal kit quantity quantity message
Test 12 New meal kit price Entering the new Show enter meal kit
meal kit price price message
Test 14 Exit admin account Enter yes or no to the the program will stop
confirm message
Test 15 Added new meal kit Display new meal kit Added menu list
menu menu
Test 16 Added new meal kit Display meal kit Meal kit should be
menu menu successfully added in the menu list
38
4.2 Test Case
Test case Test 01
ID
Screenshot
39
Test case Test 02
ID
Screenshot
40
Test case Test 03
ID
Screenshot
41
Test case Test 04
ID
Screenshot
42
Test case Test 05
ID
Screenshot
43
Test case Test 06
ID
Screenshot
44
Test case Test 07
ID
Screenshot
45
Test case Test 08
ID
Screenshot
46
Test case Test 09
ID
Screenshot
47
Test case Test 10
ID
Screenshot
48
Test case Test 11
ID
Screenshot
49
Test case Test 12
ID
Screenshot
50
Test case Test 13
ID
Screenshot
51
Test case Test 14
ID
Screenshot
52
Test case Test 15
ID
Screenshot
53
Test case Test 16
ID
Screenshot s
54
Test case Test 17
ID
Screenshot s
55
Test case Test 18
ID
Screenshot
56
Test case Test 19
ID
Screenshot
57
References
Webopedia.com. (2019). What is Object-Oriented Programming? Webopedia
Definition. [online] Available at:
https://www.webopedia.com/TERM/O/object_oriented_programming_OOP.html
MDN Web Docs. (n.d.). MDN Web Docs. [online] Available at:
https://www.developer mozilla.org [Accessed 14 Jan. 2021].
58
.
59