You are on page 1of 29

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Đỗ Hoài Nam Student ID GCH190700

Class GCH0901 Assessor name Đỗ Tiến Thành

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.

Student’s signature

Grading grid

P1 M1 D1
❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
Table of content:....................................................................................................................................................................................................... 5
I. Introduction:...................................................................................................................................................................................................... 6
II. Software development life cycle:...................................................................................................................................................................6
1. Algorithm Definition...................................................................................................................................................................................... 6
2. Definition of Software development life cycle..............................................................................................................................................6
3. SDLC Cycle.................................................................................................................................................................................................... 6
3.1 Requirement Gathering and Analysis:.................................................................7
3.2 Design:.....................................................................................7
3.3 Implementation or Coding:........................................................................8
3.4 Testing:...................................................................................8
3.5 Deployment:.................................................................................8
3.6 Maintenance:.................................................................................8
III. Analysis and Design:...................................................................................................................................................................................... 8
1. Analysis the problem and produce corresponding design:.........................................................................................................................8
2. Conditional statements needed in the problem:..........................................................................................................................................8
3. Use case and Flowchart:.............................................................................................................................................................................. 12
Option1: Input information of customer................................................................................................................................................................ 13
Option 2: Menu option........................................................................................................................................................................................... 14
Option 3 Display customer bill.............................................................................................................................................................................. 15
IV. Implementation............................................................................................................................................................................................ 16
4.1 Code................................................................................................................................................................................................................. 16
 Explain do-while loop..........................................................................17
 Explain switch Switch-case.......................................................................18
 Explain while loop.............................................................................20
4.2 Compile and Running...................................................................................................................................................................................... 21
 Explain your choice............................................................................23
V. Evaluation......................................................................................................................................................................................................... 24
5.1 reason to use switch-case instead of if-else......................................................................................................................................................24
5.2 the reason for using the while statement in the input section...........................................................................................................................24
5.3 the reason for using the do-while statement.....................................................................................................................................................24
5.4 reasons for using data types............................................................................................................................................................................. 24
5.5 algorithms is the best........................................................................................................................................................................................ 24
VI. Conclusion...................................................................................................................................................................................................26
References.........................................................................................................................................................................................................27
Table of content:
Figure 1 SDLC Cycle.................................................................................................................................................................................................. 7
Figure 2 switch.......................................................................................................................................................................................................... 10
Figure 3 if-else statement........................................................................................................................................................................................... 11
Figure 4 While loop................................................................................................................................................................................................... 11
Figure 5 do-while....................................................................................................................................................................................................... 12
Figure 6 Use case....................................................................................................................................................................................................... 12
Figure 7 input information......................................................................................................................................................................................... 13
Figure 8 Menu option................................................................................................................................................................................................ 14
Figure 9 customer bill................................................................................................................................................................................................ 15
Figure 10 part1........................................................................................................................................................................................................... 16
Figure 11 part2........................................................................................................................................................................................................... 18
Figure 12 part 3.......................................................................................................................................................................................................... 19
Figure 13 part 4.......................................................................................................................................................................................................... 20
Figure 14Menu.......................................................................................................................................................................................................... 21
Figure 15 input login Successful................................................................................................................................................................................ 21
Figure 16 input login error......................................................................................................................................................................................... 22
Figure 17 selected dishes........................................................................................................................................................................................... 22
Figure 18 Bill............................................................................................................................................................................................................. 23
I. Introduction:
Life is changing every day and we also need to change in order to keep up with the times. That's why manual billing in restaurants is
now obsolete. Instead I created a program that automates the billing of the customer's entered information is used. Users will no longer
have to write by hand as before, people will be easier and save time and effort at work. People can order their favorite dishes, they can
see the price of the food they ordered and all costs will be charged and when you want to pay the program will automatically bill you.
Payments are required with the exact same amount you ordered. This program has not been fully developed yet and further
development is required to be as expected. But development will never stop in this program.

II. Software development life cycle:


1. Algorithm Definition.
An algorithm (pronounced AL-go-with-um) is a problem-solving process or formula, based on a sequence of actions. An extensive
algorithm may be seen as a computer program. An algorithm usually means a small procedure in mathematics and computer science
that solves an ongoing problem.

Figure 1 algorithm.
2. Definition of Software development life cycle.
A software development life cycle (SDLC) model is a conceptual framework describing all activities in a software development
project from planning to maintenance. This process is associated with several models, each including a variety of tasks and activities.
Software development is a cumbersome activity requiring proper identification of requirements, their implementation, and software
deployment. However, the activities do not end there. After the distribution of the software, proper maintenance has to be provided in
a timely manner. This term is also known as the software development process model.

3. SDLC Cycle.
SDLC is a process that defines the different stages involved in the development of high-quality product delivery software. The SDLC
phases cover the entire life cycle of the software, i.e. from the beginning to the retirement of the product. The adherence to the SDLC
process leads to the development of software in a systematic and disciplined manner. The process consist of 6 step.

Figure 2 SDLC Cycle.


3.1 Requirement Gathering and Analysis:

During this phase, all the relevant information is collected from the customer to develop a product as per their expectation. Any
ambiguities must be resolved in this phase only.
The business analyst and Project Manager set up a meeting with the customer to gather all the information like what the customer
wants to build, who will be the end-user, what is the purpose of the product. Before building a product a core understanding or
knowledge of the product is very important.[ CITATION sof202 \l 1033 ]

3.2 Design:
At this stage, the framework and program architecture are drawn up on the basis of the specifications reviewed during the first stage.
System design tends to identify hardware and system specifications and to define the system's entire architecture as well. The device
architecture specifications provide criteria for the next stage of the model. In this phase, the testers established the test plan, where
they specified what to test, how to test.[ CITATION sof202 \l 1033 ]

3.3 Implementation or Coding:


The work is split into modules/units and upon receipt of system design papers, actual coding begins. Since the code is developed in
this process, it is the main priority of the developer. This is the longest period of the software development life cycle.

3.4 Testing:
After developing the code, the product is tested against the requirements to ensure that the needs addressed and collected during the
requirements phase are actually resolved. During this stage, all kinds of functional testing are performed, including unit testing,
integration testing, system testing, acceptance testing, and non-functional testing.

3.5 Deployment:
After positive inspection, the substance is shipped to the customer for use. After the product is given to the clients, the first beta test
will take place. If any changes are needed or vulnerabilities are discovered, they must be recorded by the production team. Since these
changes are made or errors are corrected, the actual implementation will take place.
3.6 Maintenance:
Once customers start using the program they create, the real issues occur, and from time to time need to be resolved. This process is
known as maintenance, where care is taken for the product produced.

III. Analysis and Design:


1. Analysis the problem and produce corresponding design:

Having to write invoices by hand is outdated because it takes a lot of time to write and calculate the things that the customer has
ordered to understand these problems. I wrote this invoice printing program to help save money. save time and effort to speed up
work. The program has two main functions: the first is to enter information of customers and the second function is to print out
customer invoices.

2. Conditional statements needed in the problem:


Data types and structures needed in the problem:
 Use interger.

Int, short for "integer", is a type variable platform built into the compiler and used to define variables that contain integers.
Is the declaration of the type of integer according to the computer's most natural size The declaration of type, int is suitable for this
case because int is an integer declaration, its identifier must be an integer, so it is not possible to declare type float and other data
types.

 Use string.

String in C # is used to store text.


A string variable contains a set of characters surrounded by double quotes "..."

Loop statement use in program:


 Use do / while loop to create Menu options. Use the switch case statement in the do / while statement to create the Menu
Option. Menu Option has 2 options: Enter Customer Information and Display Customer Information.
 Condition statement use in program:
 Switch case branch structure.
switch case is a branch statement that uses expressions to decide which direction the program will go in.

Figure 3 switch.

 If -else statement

The if - else branch statement is based on a condition. A condition is an expression that will be validated as soon as the statement is
encountered. If the condition is checked to be true, then the statement or a block of statements within the body of the if statement is
executed, if false else executes.
Figure 4 if-else statement.

 While loop.
This statement first checks the condition if it is true then executes the block if false exits the loop, then checks the condition again, and
if it is true then executes the block again ... and so on until the condition is false.

Figure 5 While loop.

 do-while loop.
The function of do-while loop is exactly the same as while loop except for loop control the condition is computed after the block is
executed. So will be done at least once even if it's wrong The do ... while loop is always executed at least once.
Figure 6 do-while.
3. Use case and Flowchart:

Figure 7 Use case


Option1: Input information of customer.

Figure 8 input information.


Option 2: Menu option

Figure 9 Menu option.


Option 3 Display customer bill.

Figure 10 customer bill.


IV. Implementation.

4.1 Code.
Code listing.

Figure 11 part1
 Explain do-while loop

Using do-while to facilitate, Execute statements in do-while loop block. Then When it reaches the end of the do-while loop, the
program determines that the value of the loop condition is that the choice variable must be nonzero and non-zero. If the expression has
a true value (nonzero and non-8), the program will go back to step 1 to continue executing the new loop.

If the expression has the following value (equal to 0 or equal to 8), the program will exit the cycle and go to the correct statement after
the semicolon at the end of the keyword do-while.
Figure 12 part2

 Explain switch Switch-case.

The switch statement is a multicast selector that compares the value of an expression to a list of integer constants or constant
characters.
When a match is encountered, the statements associated with that constant are executed.
Figure 13 part 3
Figure 14 part 4.
 Explain while loop.

while loop will perform the value of the conditional expression. If the conditional expression returns true i <3 then the statements and
blocks in the body of the loop will be executed. It then returns to check whether the loop condition is correct or not. If the loop
condition returns false then the statements will not be executed and skip the loop to go to the next command in the program.
4.2 Compile and Running.
Menu after press F5:

Figure 15Menu.

Figure 16 input login Successful.


Successful login status is when you have entered the correct information about yourself and the desired desk number along with the
password for that desk.

Figure 17 input login error.


The login failure status is when you have incorrectly entered information about yourself and the desired desk number and the
password for that desk

Figure 18 selected dishes.


The items chosen by the customer will be printed with the price of each item so that customers can order items that fit their budget and
also check the bill to see if the restaurant is correct.

Figure 19 Bill.
Finally, the function has the function to print out the customer's invoice along with the number of items that the customer ordered,
print out the items that the customer ordered can calculate the amount that the customer must pay for the dishes. called along with
their numbers.

 Explain your choice.

If option 1 is selected, the user can enter, Name, number of tables he wants to select and import separately for that table so that others
who want to enter need to enter the correct new password, and then can choose The dish is on the list from choice number 2 to number
5 And then select option 6 to see all the billing information the customer is charged.
V. Evaluation.

5.1 reason to use switch-case instead of if-else.


Structure the Switch-case statement is a multicast selector that compares the value of an expression to a list of integer or literal
constants.
The switch statement is a multicast selector that compares the value of an expression against a list of integer constants or constant
characters. When a match is encountered, the statements associated with that constant are executed.
The switch-case branching structure is often used to replace if-else constructs when too many variations can occur.
In this case, for example, after entering the customer information, they can choose from option 2 to option 5 so they can choose the
item. So this means we will have 4 if statements. simple or more nested if-else statements. This causes complexity, confusion, and
length of a program. So here we can use the switch - case statement to remedy this situation.

5.2 the reason for using the while statement in the input section.
There is a problem with for loop that we do not know in advance the number of iterations of the script. For example, enter customer
information if the number is not satisfied then re-enter. Obviously, we absolutely cannot know how many times the user will enter. So
while loop will help us to solve this problem.

5.3 the reason for using the do-while statement.


Do while loop: The number of loops is unknown, executing the code inside the loop first and then checking the condition, so the code
inside the do-while loop is executed at least once.

5.4 reasons for using data types.


I use the int data type in this post because the data in this exercise I use are all positive numbers without decimals and furthermore
these data types match int,
I use the string type in the post to be able to declare a string that is specific here to enter the customer name in the input.

5.5 algorithms is the best


This algorithm of mine is divided into the first 3 parts so that the second part is the main menu with the customer-specific options, the
last part is to print the invoice with the parts that the customer has chosen from there using. Loop statements, such as while, do-while
switch case to be able to create main functions and use data types that match the idea of the problem. From there it can be confirmed
that the algorithm I use in this program is the best.
VI. Conclusion.
This program was created to help us not have to write bills by hand, but just wait for customers to choose the dishes they want to
automatically print the information of the dishes and pay for it. customers see that we can save time and effort so we can easily review
upgrades. It also makes it easy for our employees and customers to control everything.

• What can be improved: This is just the foundation program, apart from the program so that it can be developed more in the future.
For example, the user can enter data to organize and check whether the tables in the restaurant have been reserved or check if the same
name or wrong dictionary is entered in other tables so that tables can be added or deleted. booked but canceled because of a
multiplication problem. Or moreover, it can be developed into a Mobile App, Window App, with a simple interface, easy to use,
receive instant notifications from the restaurant to customers when there are new developments or customer gratitude occasions.

• What is the limitation: when entering wrong information, sometimes the system crashes and the program will stop.
References
Anon., n.d. freetuts. [Online]
Available at: https://freetuts.net/vong-lap-while-trong-csharp-1148.html
[Accessed 13 12 2020].

Anon., n.d. howkteam. [Online]


Available at: https://www.howkteam.vn/course/khoa-hoc-lap-trinh-c-can-ban/vong-lap-while-trong-c-91
[Accessed 13 12 2020].

Anon., n.d. softwaretestinghelp. [Online]


Available at: https://www.softwaretestinghelp.com/software-development-life-cycle-sdlc/
[Accessed 10 12 2020].

Anon., n.d. stackify. [Online]


Available at: https://stackify.com/what-is-sdlc/
[Accessed 10 12 2020].

You might also like