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 Mai Trần Nguyên Khôi Student ID GBS190474
Class GCS0806_NX Assessor name
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 D
1
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
Page 2
Page 3
Task 1 : State your simple business problems to be solved.
Algorithm
Type of algorithms
Characteristics of an algorithm
Task 2 : Analyze the problem and design the solutions by the use of suitable methods.
I. I.Defining or Analyzing the problem
II. II.Flowchart
Task 3: Demonstrate the compilation and running of a menu-based program.
I. I.Steps in program development
II. II.Support tools
References
Page 4
Task 1 : State your simple business problems to be solved
1. Algorithm
- An algorithm is a self-contained step-by-step set of operations to be performed to solve a specific
problem or a class of problems
▪ For example, an algorithm for driving to a friend’s house could be:
• Find your keys
• Walk out of the house
• Close the door
• Open the door
• Get into the car
• Put the key into the ignition, etc….
- An algorithm is a precise step-by-step plan for a computational procedure that possibly begins with
an input value and yields an output value in a finite number of steps in order to solve a particular
problem.
- A computer program is a sequence of instructions that comply the rules of a specific programming
language, written to perform a specified task with a computer.
Page 5
Page 6
Example of algorithm :
Page 7
2. Type of algorithms
Simple recursive algorithm
void recursion ()
recursion ();
- Solves the base case directly and then recurs with a simpler or easier input every time (A
base value is set at the starting for which the algorithm terminates).
- It is use to solve the problems which can be broken into simpler or smaller problems of same
type.
Dynamic programming algorithm
- A dynamic programming algorithm (also known as dynamic optimization algorithm) remembers
the part result ad uses them to find new result means it solve complex problems by breaking it
down into a collection of simpler subproblems, then solving each of those subproblems only once,
and storing their solution for future use instead of recomputing their solutions again.
Backtracking algorithm
- How about we learn backtracking using an example so let’s say we have a problem “Monk” and we
divide it into four smaller problems “M, R, A, A”. It may be these case that the solution of these
problems did not get accepted as the solution of “Monk”.
Page 8
- In fact we did not know on which one it depends. So we will check each one of them one by one
until we find the solution for “Monk”.
- So basically we attempt solving a subproblem but if we did not reach the desired solution undo
whatever you have done and start from the scratch again until you find the solution.
3. Characteristics of an algorithm
- Clear and Unambiguous: Algorithm should be clear and unambiguous. Each of its steps
should be clear in all aspects and must lead to only one meaning.
- Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs.
- Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it
should be well-defined as well.
- Finite-ness: The algorithm must be finite, i.e. it should not end up in an infinite loops or
similar.
- Feasible: The algorithm must be simple, generic and practical, such that it can be executed
upon will the available resources. It must not contain some future technology, or anything.
- Language Independent: The Algorithm designed must be language-independent, i.e. it must
be just plain instructions that can be implemented in any language, and yet the output will be
same, as expected.
Page 9
Example :
- The problem requires us to find the largest and the smallest of 3 numbers. Here are the steps to solve
the problem
After running the program, the program will ask us to enter any 3 numbers into the program
When entering 3 numbers into the program we will start to find the maximum and minimum values
of them as follows
We will assign the first value in the sequence that is the maximum value and the minimum value
Page 10
Next, we will compare that value with the rest of the sequence in order
To do that we need to use the if else statement to create a loop
If the compared value is larger than the original value we assigned, the max (min) value will now be
assigned to the compared value.
Repeating the comparison we will get the final value of max (min). That value will be saved to the
variable max (min).
Page 11
Below are all the commands to perform the search for the largest and smallest number.
Page 12
Not only can we find the minimum and maximum values of 3 numbers, but we can also find arrays with
more values if we use the algorithm. With the creation of a comparison loop, we can find out the value we
want
Page 13
Task 2 : Analyze the problem and design the solutions by the use of suitable methods.
I. Defining or Analyzing the problem
- During this stage, the programmer identifies the problem and decides its boundary. During this
stage, the programmer needs to understand the problem statement, what the requirement is, and
what is the output of the problem solution. They are identified in the early stages of the program
development life cycle.
- In stage 2, the programmer defines the requirements such as variables, functions, etc, … to solve
the problem. That means that the developer gathers the resources needed to solve the problem
identified during the problem definition phase. The programmer also determines the limitations of
the solution.
- Programmers must use tools to help write code to solve problems, use appropriate algorithms for
the problems that customers give.
- Some applications can use
Page 14
II. Flowchart
Page 15
Task 3 : Demonstrate the compilation and running of a menu-based program
I. Steps in program development
1. Planning and analysis
- During this stage, the programmer identifies the problem and decides its boundary.
During this stage, the programmer needs to understand the problem statement, what the
requirement is, and what is the output of the problem solution. They are identified in the
early stages of the program development life cycle.
Page 16
- In stage 2, the programmer defines the requirements such as variables, functions, etc, …
to solve the problem. That means that the developer gathers the resources needed to
solve the problem identified during the problem definition phase. The programmer also
determines the limitations of the solution.
2. Design
- An algorithm is a series of instructions often referred to as a “process,” which is to be followed
- when solving a particular problem. While technically not restricted by definition, the word is almost
invariably associated with computers, since computer-processed algorithms can tackle much larger
problems than a human, much more quickly. Since modern computing uses algorithms much more
frequently than at any other point in human history, a field has grown up around their design,
analysis, and refinement. The field of algorithm design requires a strong mathematical background,
with computer science degrees being particularly sought-after qualifications. It offers a growing
number of highly compensated career options, as the need for more (as well as more sophisticated)
algorithms continues to increase.
3. Coding
- This phase uses a programming language to write or execute actual programming instructions for
the steps defined in the previous stage. In this stage, the programmer builds the reality program.
That means the programmer writes a program to solve a given problem in programming languages
such as C, C ++, C #, Java, or the programmer's Forex programming languages.
4. Documenting the program
- Documents related to the program:
• Program design documents
• Coding documents
• Documents of program manual
• Document form customer use
- These documents may be reused to upgrade or repair. Some other document can provide to
customers.
5. Testing and Debugging
- During this stage, the programmer checks to see if the code written in the previous step solved the
specified problem. That means the programmer checks the program to see if it is solving the
Page 17
problem for different input data values. The programmer also checks to see if it delivers the desired
output.
6. Compiling and running the program
- After testing and debugging have completed, program will be deployed and put into use in practice.
The computer have a program will compile a programmer’s code into Ascii’s code
(01100101,01100111,….) to program can run in computer.
- Before the user can truly start using the system, the programmer and coder needs to create the
necessary document or data files to teach the user and ensure the systems is used most effectively.
7. Maintenance
- During this stage, the program is actively used by the user. If any improvements are found during
this phase, all stages will be repeated again to make the improvements. That means in this phase
the solution (the program) is used by the end user. If the user encounters any issues or wants
any improvements, the programmer needs to repeat all the stages from the beginning for the
problem encountered to be resolved or the advanced feature added.
II. Support tools
Page 18
- Main screen of visual studio support tool
- I have some step taken from writing code to execution when visual studio open
o Step 1: Create a new project table
Click create a new protect in start page
Create a new project or icon
o Step 2: After create a new project table appear
Click Console App (.NET Core)
After click Next
▪ Should Rename in Name stage
▪ Choose location for program
Page 19
- Visual studio working screen
Page 20
- Report the results below after each test run
Page 21
Page 22
- Monitor the results after running the program
Page 23
References
1. Slideshare.net. 2021. What is an algorithm?. [online] Available at:
<https://www.slideshare.net/AngelaDeHart/what-is-an-algorithm-130758029> [Accessed 16 April 2021].
2. Includehelp.com. 2021. Algorithm and its types - IncludeHelp. [online] Available at:
<https://www.includehelp.com/data-structure-tutorial/algorithm-and-its-types.aspx> [Accessed 16 April
2021].
3. GeeksforGeeks. 2021. Introduction to Algorithms - GeeksforGeeks. [online] Available at:
<https://www.geeksforgeeks.org/introduction-to-algorithms/> [Accessed 16 April 2021].
4. Mql5.com. 2021. Program Development Life Cycle in 6 Steps. [online] Available at:
<https://www.mql5.com/en/blogs/post/713281> [Accessed 16 April 2021].
5. Lynda.com - from LinkedIn. 2021. Learning C# Algorithms. [online] Available at: <https://www.lynda.com/C-
tutorials/Learning-C-Algorithms/604241-
2.html#:~:text=Understanding%20algorithms%20is%20a%20key,searching%2C%20sequencing%2
C%20and%20more> [Accessed 16 April 2021].
6. Society, I., 2021. CS 224: Advanced Algorithms (Fall 2014, Harvard Univ.) | Computer Science | Audio/video
Courses. [online] Infocobuild.com. Available at: <http://www.infocobuild.com/education/audio-video-
courses/computer-science/cs224-fall2014-
harvard.html#:~:text=CS%20224%3A%20Advanced%20Algorithms%20(Fall,2014%2C%20Harvard
%20Univ.).&text=An%20algorithm%20is%20a%20well,time%20and%2For%20memory%20consu mption>
[Accessed 16 April 2021].
7. Edureka. 2021. Introduction to C Programming-Algorithms | Edureka.co. [online] Available at:
<https://www.edureka.co/blog/introduction-to-c-programming-
algorithms/#:~:text=An%20algorithm%20is%20a%20procedure,Tasks%20to%20be%20preformed> [Accessed
16 April 2021].
8. Btechsmartclass.com. 2021. C Tutorials - Program Development Life Cycle. [online] Available at:
<http://www.btechsmartclass.com/c_programming/C-Program-Development-Life-Cycle.html> [Accessed 16
April 2021].
9. The Economic Times. 2021. What is Debugging? Definition of Debugging, Debugging Meaning - The Economic
Times. [online] Available at:
<https://economictimes.indiatimes.com/definition/debugging#:~:text=Description%3A%20To%20
Page 24
debug%20a%20program,problem%2C%20and%20then%20fix%20it.&text=Debugging%20tools%
20(called%20debuggers)%20are,errors%20at%20various%20development%20stages> [Accessed 16 April
2021].
10. Medium. 2021. A difficult relationship between algorithms and code. [online] Available at:
<https://medium.com/@francescoimola/a-difficult-relationship-between-algorithms-and-code-
bfb1da9bb856> [Accessed 16 April 2021].
Page 25