BTEC Level 5 HND Computing Unit 1: Programming and Problem Solving

Verified

Added on  2022/01/15

|36
|7565
|62
Report
AI Summary
This report, submitted for a BTEC Level 5 HND Diploma in Computing, Unit 1: Programming, delves into the core concepts of algorithms and their application in problem-solving. The report begins with a definition of algorithms, their characteristics, advantages, and disadvantages, along with illustrative examples and flowcharts. It then progresses to analyzing business problems, outlining the steps involved in problem-solving, and demonstrating how algorithms can be used to address these challenges. The report includes detailed flowcharts and C# code to illustrate the practical implementation of algorithms within the context of a student information system. The report also includes a discussion of the Software Development Life Cycle (SDLC) and test plans to evaluate the effectiveness of the solutions. The report concludes with an evaluation of the problem-solving approach and algorithm design.
Document Page
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 Student ID
Class RT7 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 D1
1
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
2
Document Page
Summative Feedback: Resubmission
Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
1
Document Page
2
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Table of Contents
I. Introduction.........................................................................................................................5
II. Algorithm.............................................................................................................................5
1. Definition of algorithm....................................................................................................6
2. The characteristics of an algorithm..................................................................................7
3. Advantages and disadvantages of algorithm....................................................................8
4. Algorithm for Simple Problem........................................................................................8
III. Business problems.........................................................................................................11
1. Definition of business problems....................................................................................11
2. Steps for problem solving..............................................................................................11
2.1 Analyzing the problem...........................................................................................12
2.2 Developing an algorithm........................................................................................12
2.3 Coding....................................................................................................................12
2.4 Testing and Debugging...........................................................................................12
3. Solve business problems by algorithms.........................................................................13
3.1 Analyze the problem...............................................................................................13
3.2 Function..................................................................................................................15
IV. Demonstrate application...................................................................................................21
1. Demonstrate and run program.......................................................................................21
2. SDLC and source code...................................................................................................29
V. Evaluation problem...........................................................................................................31
1. Test plan and test case....................................................................................................31
2. Evaluation how to solve problems from algorithms......................................................33
VI. Conclusion........................................................................................................................33
VII. References......................................................................................................................34
3
Document Page
Table of figures
Figure 1. What is algorithm?......................................................................................................6
Figure 2. Properties of algorithm................................................................................................7
Figure 3. Shapes or symbol to draw flow charts.........................................................................9
Figure 4. Flowchart to calculate square of a number................................................................10
Figure 5. Code to calculate square of a number........................................................................10
Figure 6. The result of the algorithm to find the square of a number.......................................10
Figure 7. Step for problem solving...........................................................................................12
Figure 8. Operation diagram of the program............................................................................14
Figure 9. Variables and data types............................................................................................15
Figure 10. Menu of system.......................................................................................................15
Figure 11. Flowchart Main menu..............................................................................................16
Figure 12. Flowchart Input Student..........................................................................................18
Figure 13. Flowchart Print information of student...................................................................19
Figure 14. Flowchart function Rank.........................................................................................20
Figure 15. Flowchart function Average....................................................................................21
Figure 16. Flowchart function Pass..........................................................................................21
Figure 17. Main menu...............................................................................................................22
Figure 18. Menu result..............................................................................................................23
Figure 19. Code function input.................................................................................................24
Figure 20. Code function print..................................................................................................24
Figure 21. Input data.................................................................................................................24
Figure 22. Function input..........................................................................................................25
Figure 23. Result of function print............................................................................................26
Figure 24. Code function rank..................................................................................................26
Figure 25. Result of unction rank.............................................................................................27
Figure 26. Code of function average.........................................................................................27
Figure 27. Result of function average.......................................................................................28
Figure 28. Code function pass..................................................................................................28
Figure 29. Result of function pass............................................................................................29
Figure 30. Exit program............................................................................................................29
Figure 31. C# code compilation................................................................................................30
Figure 32. Test plan..................................................................................................................31
Figure 33. Test case..................................................................................................................32
4
Document Page
I. Introduction
Algorithm is a concept of Mathematics and Informatics. The study of algorithms is very
important in computer science in general, or software programming in particular. My report
will provide a definition of what an algorithm is and outline the process in building an
application.
My assignment includes 4 parts:
First, I need to provide an overview about Algorithm with image illustration,
explanation and example. Next, I will represent a small and simple problem, why it is
needed to be solved and how an algorithm could help to solve it.
Secondly, I will analyze the business problem and turn it into application requirements
Thirdly, you have to demonstrate how the application is implemented by using
suitable programming language.
Finally, I will evaluate how the problem is solved from the designed algorithm to the
execution program written by a specific programming language.
II. Algorithm
Can you think of a day in your life which goes without problem solving? Of course, the
answer to this question is, No. In life, we are bound to solve problems. In our daily activities,
such as buying something from a general store and paying, depositing money in school or
withdrawing money from a bank account. All of these activities involve some kind of problem
solving. It can be said that any activity that a human or a machine performs to achieve a
particular goal is accompanied by problem solving. To make it clearer, let us look at some
other examples.
Example 1: If you are watching a news channel on your TV and you want to change it to a
sports channel, you need to do something i.e., move to that channel by pressing that channel
number on your remote. This is a kind of problem solving.
Example 2: If someone asks to you, what time is it? So, seeing the time on your watch and
telling him is also a way of solving the problem.
Now, broadly we can say that problem is a kind of barrier to achieve something and problem
solving is a process to get that barrier removed by performing some sequence of activities.
If you can solve a given problem then you can also write an algorithm for it.
In next section we will learn what is an algorithm.
5
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1. Definition of algorithm
Algorithm is one of the foundations of programming. There are many definitions of
algorithms, such as:
Algorithm can be defined as: “A sequence of activities to be processed for getting desired
output from a given input.”
Webopedia defines an algorithm as: “A formula or set of steps for solving a particular
problem. To be an algorithm, a set of rules must be unambiguous and have a clear stopping
point”. There can be many ways to solve a problem, so there can be more than one algorithm
for a problem.
Now, if we take definition of algorithm as: “A sequence of activities to be processed for
getting desired output from a given input.” This is why algorithm refers to a set of
rules/instructions that define step by step how to do work to achieve an expected result.
Figure 1. What is algorithm?
Thus, the entire algorithmic flowchart will have three main components:
Input: What we already know or things we have to start with.
Algorithm: A set of sequenced steps that we need to follow one by one.
Output: The expected results we need to achieve in the end.
Algorithms take in zero or more inputs and give back one or more outputs. A recipe is a good
example of an algorithm because it tells you what you need to do step by step. It takes inputs
(ingredients) and produces an output. For instance, the Coffee Maker Algorithm would run
something like
Turn on Coffee Maker
Grind Coffee Beans
Put in filter and place coffee in filter
Add Water
Start brewing process
Drink coffee.
In computer programming, algorithms are often created as functions. These functions serve as
small programs that can be referenced by a larger program. For example, an image viewing
application may include a library of functions that each use a custom algorithm to render
6
Document Page
different image file formats. An image editing program may contain algorithms designed to
process image data. Examples of image processing algorithms include cropping, resizing,
sharpening, blurring, red-eye reduction, and color enhancement.
Algorithm is developed first before writing the program. By using good algorithm, we can
improve efficiency of the program. Algorithm is not the complete program or code, it is just a
solution of a problem or the set of steps that are required to solve a problem, which can be
represented either using a Flowchart or Pseudo code.
2. The characteristics of an algorithm
Donald Ervin Knuth has given a list of five properties for a, algorithm, these properties are:
Figure 2. Properties of algorithm
1) Input: An algorithm must be provided with 0 or more number of input/data values or
in some cases no external input is provided.
2) Output: After processing the statements in algorithm step-by-step statements will
generate some result. Hence at least 1 output must be produced. This enables us to
verify the algorithm.
3) Finiteness: An algorithm must always terminate after a finite number of steps. It
means after every step one reach closer to solution of the problem and after a finite
number of steps algorithm reaches to an end point.
For example
1. Let a = 10
2. If a >10 then go to step 5
3. x = y * z
7
Document Page
4. Print x and go to step 2
5. Stop.
Here we notice that in algorithm the value of a is not changed, which happens to be
controlling the flow and hence never terminates. Such statement must be avoided. The
finiteness property ensures that the unambiguity in the flow.
4) Definiteness: Each step of an algorithm must be precisely defined. An algorithm must
be unambiguous and clear. Each step of algorithm and input/outputs must be clear.
There is only one meaning of each step of algorithm.
5) Effectiveness: Algorithms to be developed/written using basic operations. It must be
possible that every step of the algorithm to be carried out by a person manually using
only pencil and paper. The statements of algorithm must be feasible to convert in
computer program.
3. Advantages and disadvantages of algorithm
Advantages of algorithm:
Algorithms are easy to understand.
It is very helpful for a programmer to write a code by understanding the algorithm.
It breaks down the logic or problem inti simple steps or a set instruction.
Every step in an algorithm has its own logical sequence so it is easy to debug.
Disadvantages of algorithm:
Algorithms take more time to apply on.
An algorithm is not a computer program; rather, it is a concept that describes how a
program should be written.
Big programs are difficult to add in an Algorithmic way.
Complex logic can be quite confusing when using algorithms.
In algorithms, it is difficult to show branching and looping statements.
4. Algorithm for Simple Problem
From the example of how-to-make-tea which I have already mentioned earlier. I want to give
out more examples and to show that algorithms also take part in procedural programming.
Here, I will use Flowchart to illustrate the algorithm. So, what is Flowchart?
A flowchart is a visual representation of an algorithm.
A flowchart is a diagram made up of boxes, diamonds and other shapes, connected by arrows.
Each shape represents a step of the solution process and the arrow represents the order or link
among the steps.
There are standardized symbols to draw flowcharts. Some are given in Table below.
8
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
Flowchart
symbol
Function Description
Start/End Also called “Terminator” symbol. It indicates
where the flow starts and ends.
Process Also called “Action Symbol”, it represents a
process, action, or a single step.
Decision A decision or branching point, usually a yes/no
or true/false question is asked, and based on the
answer, a path gets split into two branches.
Input/Output Also called data symbol, this parallelogram
shape is used to input or output data.
Arrow Connector to show order of flow between
shapes.
Figure 3. Shapes or symbol to draw flow charts
Some examples of algorithms.
Example 1: Write an algorithm to find the square of a number.
Before developing the algorithm, let us first identify the input, process and output:
Input: Number whose square is required
Process: Multiply the number by itself to get its square.
Output: Square of the number.
Algorithm to find square of a number.
Step 1: Input a number and store it to num
Step 2: Compute num * num and store it in square
Step 3: Print square
There can be represented pictorially using flowchart as show in Figure below.
9
Document Page
Figure 4. Flowchart to calculate square of a number
The below program asks the user to enter the value. After getting the value from the user it
will calculate the square of entered number by using arithmetic multiplication operator.
Figure 5. Code to calculate square of a number
And the result:
Figure 6. The result of the algorithm to find the square of a number
10
chevron_up_icon
1 out of 36
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]