Provide a definition of what an algorithm is and outline the process in build- ing an application P1 1.1 Define Algorithms: -An algorithm is a finite set of instructions to do somethin
Trang 1STUDENT ; VU PHONG THAI CLASS : ITO5102
STUDENT ID: BDOOII5 SUPERVISOR :NGUYEN HOANG ANH VU
DaNang, June 2022
Trang 2
Student name Vu Phong Thai Student ID BDO00115
Class IT05102 Assessor name Hà HOANG ANH
Trang 4In addition to my mentor, I would like to thank my friends who have helped me improve
my knowledge of my subject Not only that, they are always there to support me when I need it And besides, I would like to thank the school for creating all conditions for me to have adequate facilities to help me complete my work
Trang 6‘BTEC ‘BTEC
Alaxe wih [Bg ca‹:con
Table of Contents ACKNOWLEDGMENTS 2-2 nhe 2
ˆ S0 0090 500 3 LIŠT OEF TABLES AND EIGURES - 2-2 c nhường 5 LIST OEF THE ACRONYM HH re 6 INTRODUCTION 2 2H HH HH r ưg 7 CHAPTER 1n 8
II) ốc 8 I0 00012.9 si T7 8 1⁄2 Ways to demonstrate algOrIthm§: che 9
li s0 9
*The second way: Using Flowchart che 11 1.3 Characteristic of AlgOrIthims: - cờ 13 1.4 Steps in program đevelOpIN€HI - + + nành re 15 M1 Determine the steps taken from writing code to eX€CU€ co 18 D1 Evaluate the relationship between the algorithm and the program code: 24
S112 1111111111111 T111 TT T111 T177 TH 24 0).409.0.907/.900.4009)0 01 25 09)98013i9)0155 26
3935490010017 27
Trang 7‘BTEC ‘BTEC
Alliance with ago Education
LIST OF TABLES AND FIGURES
Figure 1-1: AlgOrIthms - cu on ĐH TH HH KT Ti bọ Ko Kế nh Tá Kế ki ko cà ki rà § Figure 1-2: Micellar water 0.0 Ắằ 8 Figure1-3 : Example - cọ TH TH KĐT ko Kì TK Ki bế nh bò Ki ko À ki SE 9 Figurel-4 : Example - cọ TH TH bon ko Kn KT ko bế nh bò Ki ki ki KSEH 9 Figurel-5: Flowchart syimbols - co nh HT HT KH KT ky kh Kinh nà ki ky kế 11 Figure1-6 :Determine which number Is the bigø€S( cuc cà SH nh nên 12 IIE2010/00,i0e0 7n .eax 12 Figure 1-8: algorithms-charaC(€riS([CS§ - cà SH TH KT ko ko TK kh Ben ki cá ko Kn bà cà 13 Figure1-Ð : FlowChart( - -c co ĐT HH TH KT bọn kh kì Co KT bà Ko bế nh k Ko bi Đi cá ki 14 Figure 1-10: The software development CYCÏ€ - c- con nọ TH nen kh cá ko kẻ 15 Figure 1-11: Visual StUdiO - ĐT KT ĐH netted tee beatae TK Thế T kh ki ti Bà 15 Figure 1-12: Design and PrOtOtYpIHE co HT nen ĐK Kế nh bọ ki in KĐT ki 16 Figure 1-13: SOUFC€ COd€ CS HT nh KĐT KT ko Ko Kế hề ko Tá Ki KĐT ki ch ki kế 16 Figure 1-14: Debugging the program - -.- Là ĐT ĐH KT bon kh kh ki cá ki kia 17 Figure 1-15: Try three random numb€rs - -c cà cọ ST Tnhh penta e nena 17 Figure 1-162 a=b=C=0 ÁẮÁẶŒa ened rE een be dbo net eben tae bea ees 17 Figure 1-17: Menu Service ee ee EEE d4 18 Figure 1-18: Flowchart M1 ''ttcaadiiiiiiiâiaẳai dard eee 20 200101505 EEE LEER EOD EEH AGE Rene etre tenant eet ben aed 19 Figure 1-18-20 ee EEE EEE EEE cà Kệ Tà ki Ki Cà ki ki ki Tá ki 19 2010155 bead 19 i20 - EEE EE EEC EE Een EEE EEE Sener tre neni Et eet ben aed 20 Figure 1-19: Code MĨI co on ĐT Ee EEE AEE bent rE Ene et Een eee tenia 22 Figure 1-20: Error ccc ec eee nee een ee IEE EE eee Ene Ee EEA dae beeen tee tees 22 Figure 1-21: Fix aIaa|+ÝiÍiÍiiadđdđiaiẦẮỎốỐ EE EGE Ee EEE Een eH eat E Ee es 23 Figure 1-22: Run the program for the Íirsf tĨIm€ - - co CS cọ SH nh kh kh vn 23
Eigure 1-23: run the program for the second tỉme - co ch kg 23
Figure 1-24: Relationship between the algorithm and the program code - - 24
Trang 8
‘BTEC ‘BTEC
Alliance with ago Education
LIST OF THE ACRONYM USD United State Dollar
Yen Japanese money
L British Money
Y Chinese money
Won Korean money
Trang 9of instructions (or instructions) for the machine to execute in chronological order
Programming must be performed for all information processing systems, from large computing platforms and personal computers (PCs), to programmable controller chips in device control blocks of various types such as: in instrumentation and analysis, controlled weapons, washing machines, microwave ovens, and in computer peripherals such as control chips in video cards, communication ports,
Trang 10
‘BTEC ‘BTEC
Alliance with ago Education 5
CHAPTER I LOI: Define basic algorithms to carry out an operation and outline the process
of programming an application
1 Provide a definition of what an algorithm is and outline the process in build-
ing an application (P1)
1.1 Define Algorithms:
-An algorithm is a finite set of instructions to do
something, it works by asking your computer to per-
form a series of predefined actions to determine how
to get something done, something and your computer
-Imples of algorithms in real life:
+We often use one of two methods to represent the algorithm:
+I have an example of a dishwashing algorithm in simple natural language:
Step 1: Remove makeup and wash your face et
Step 2: Don't use soap on your face \ ` l
Step 3: Wash your face with warm water
Step 4: Do not use a towel to rub your face ‘ , À
Step 5: Use Micellar water makeup remover \ ˆ @
Step 6: Do not abuse facial cleansers
Step 7: Should use a washing machine
Step 8: Wash your face both on the neck and jawline 0 ae”
Figure 1-2: Micellar water
Step 9: Dry with a soft towel
Step 10: Do not wash your face too many times
Step 11: Do not use too much facial cleanser, use it rationally
Step 12: Do not exfoliate too much
Perfomed Student: Vu Phong Thai 8
Trang 11“BTEC `
Step 13: Use toner after washing your face
Step 14: Don't skip the moisturizing step
Step 15: Depending on your skin type, the number of washes will vary
1.2 Ways to demonstrate algorithms:
- [have two ways to express it:
* The first way: Using Pseudocode
-Definition: Pseudocode is a brief and non-high-quality description of a computer setup model, which uses the structured conventions of several programming languages, but of- ten leaves out unnecessary details to help better understand method more, as remove the
program, variant declaration and especially the code snippet system
It's in English so it's easy to understand
It is a language that can easily understand what it is trying to do
-Steps to write pseudocode:
Step 1: Write the appropriate task and pseudocode accordingly
Step 2: Start with the main goal or goal setting pseudocode statement
Example:
This program will allow the user to check
the number whether it's even or odd
Figure1-3 : Example
Step 3: The way if-else, for, while loops are indented in the program, indenting statements
is similar, as it helps to understand the execution and decision control mechanism They also improve readability to a large extent
Trang 12‘BTEC $
Step 4: Use proper naming conventions Human approach is to follow what we see If a programmer uses a pseudocode, his approach will be the same, so the naming should be simple and different
Step 5: Use proper capitalization, such as CamelCase for methods, uppercase for con- stants, and lowercase for variables
Step 6: Build everything that will happen in the actual code Don't make pseudocode ab-
Step 9: Don't write pseudocode in a fully programmatic way Your writing must be simple
to understand, so don't mix up too many technical terms
Trang 13“BTEC
Alliance with age Education
*The second way: Using Flowchart
contains information to represent an algorithm
Indicates a decision point
between two or more
Con represents any type
of data ina flowchart
Document
Indicates data that can be
read by people, such as
Process, such as 2 subroutine or a module
that will continue to repeat until
Connector
Indicates an inspection
point, Off-page connector Use this shape to create
a cross-reference and hyperlink from a process on one page to
8 process on another page
Off-page connector
Off-page connector
Off-page connector
or Logical OR
Sort Indicates a step that organizes items list sequentially
Internal storage
Indicates an internal storage device
- More information: The oval indicates whether the algorithm is at the beginning or the
end Its document is usually divided into two parts: "beginning" and "ending"
-Here are some examples of flowcharts in schematic form:
+The program starts at first, then reads two numbers, a and b, as shown in the graph
+The program proceeds by adding two numbers a and b
+And finally, the program writes the result to the screen and exits
-Example:
Perfomed Student: Vu Phong Thai
Trang 14“BTEC
Alliance with ago Education
+The next program is flowchart for
Average of three numbers:
Step 1: Declare a,b,c and avg
Step 2: enter a,b,c
Step 3: avg=(atbtc)/3
Step 4: Print avg
Step 1: Declare a,b
Step 2: enter a,b Step 3: C=A+B Step 4: Print C
Perfomed Student: Vu Phong Thai
Trang 15Output: When you finish an algorithm, you will have one or more results
Constraints: An algorithm is defined as non-obvious, which means that its instructions must be clear and understandable
Feature Limit: Algorithm must be the owner's limit Computational limit in this context means that the algorithm must have a limit on the number of instructions, i.e the instruc- tions must be enumerable
Efficiency: For each instruction in the oversumming image operation, it must be complete Language-independent: An algorithm must be non-local, meaning its instructions can be executed in any language and produce the same result
-Create a good algorithm by following these steps:
+ The problem can have many different solutions, but it will still produce results On the
other hand, a good algorithm will make our software run faster, the code will be shorter
and it will make our program run with as little or no error as possible and the computer will
do it faster if the algorithm performs poorly
+ Your software does not require the use of a high-end machine
-Steps to create a good algorithm
Step 1: Feel the problem description This step is quite difficult and takes a headache to think about
Trang 16‘BTEC
'BTEC
Alliance with ago Education
Step 2: Analyze the problem and build an algorithm
Step 3: Edit the algorithm by adding other details to complete an algorithm
Step 4: Review the algorithm
-Example flowchart simple:
more years
Trang 17
“BTEC “BTEC
Alliance with ago Education
1.4 Steps in program development
—
-Program development steps:
Step 1: Analyze and define the prob- 7 maintainance + =
implementation a design
output program languages i 8
Step 2: Design the program: ue aoa
You need to draw a flowchart.This is a
very important graph in the algorithm It ——
will help you solve the algorithm in a neat
way Figure 1-10: The software development cycle
Step 3: Code the program:
This is the code step where you have to write the program code in the programming lan-
guage You can write it on platforms like Microsoft Visual Studio
This is the step where you check for errors in the program you are writing and you need to
fix it Because it only takes an inch to be wrong to goa mile
Step 5: Testing:
Running the program is the step where you have perfected your program code Confirm
there are no more errors
Step 6: Deployment and maintenance:
Perfomed Student: Vu Phong Thai 15
Trang 18‘BTEC
Alliance with ago Education ‘BTEC
This is the last step where you develop your ideas and summarize what you have done
Example:
Step 1: Analyze and define the problem
-Input: Three numbers: a, b, c of the quadratic equation
-Output: The solutions of the equation
Step 2: Design the program:
-Flowchart:
Step 3: Code the progam:
Development Source code:
Trang 19z 2
Alliance with ago Education h
Step 4: Debugging the program:
- Missing accents ; and fixed the error
.Write("nhap so b: “ -
3 Write("nha ReadLine(); ‘ Parse(st);
.Write("nhap so c:
.ReadLine();
.Parse(st);
.ReadLine(); Write("nhap so c= Parse(st); 6i O
Step 6: Deployment and maintenance
- When building a website, you will always have your live website, commonly known as
production or living environment
Operation & Maintenance (O&M means the functions, tasks and labor involved)
normal day-to-day operations and repair, replacement of structural and component parts,
and other operations necessary) to preserve the property so that it continues to provide
service is accepted and the expected service life is achieved
Perfomed Student: Vu Phong Thai 17
Trang 20“BTEC `
M1 Determine the steps taken from writing code to execute
Stepl: Your boss wants you to do a currency conversion program for 5 countries UK, USA, Japan, China, Japan Because in the near future, Vietnam will open to tourists after the covid season Boss Vu has high expectations from you and promises to promote you if you do well
Step 2: flowchart and menu
Step 1: Enter password If password is true you can continute else you can not
Step 2: Menu Service :
1.Currency Coverter 2 Check account 3 Top up 4 End
-USD*22,295 -Your account is a) Enter the amount
-Nhan Dan te*3425 4732000 you want to deposit
Trang 21SBTEC
Alliance with ago Education
Step 4: Are you want to continute?
-Yes, go back to step 2
-No, say good bye
Trang 22“BTEC 'BTEC
Alliance with ago Education 5
Are you want to continute? @