You are on page 1of 17

Higher Nationals in Computing

Unit 1: Programming
ASSIGNMENT 1

Learner’s name: DUONG CHI LOC


ID:GCS200461
Class: GCS0905A
Subject code: 1618
Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:


ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date 30 September 2021 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Duong Chi Loc Student ID GCS200461

Class GCS0905A Assessor name Phan Minh Tam

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:

Signature & Date:


Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing

Student Name/ID Number: Duong Chi Loc / GCS200461


Unit Number and Title: Unit 1: Programming
Academic Year: 2021 – 2022
Unit Assessor: Phan Minh Tam
Assignment Title: Problem solving with algorithms
Issue Date: 27 September 2021
Submission Date: 30 September 2021
Internal Verifier Name:
Date:

Submission Format:

Format:

● The submission is in the form of an individual written report. This should be written in a concise,
formal business style using single spacing and font size 12. You are required to make use of
headings, paragraphs and subsections as appropriate, and all work must be supported with
research and referenced using the Harvard referencing system. Please also provide a bibliography
using the Harvard referencing system.

Submission

● Students are compulsory to submit the assignment in due date and in a way requested by the
Tutor.
● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/.
● Remember to convert the word file into PDF file before the submission on CMS.

Note:

● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style.
● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply
this requirement will result in a failed assignment.

Unit Learning Outcomes:

LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application

Assignment Brief and Guidance:

Assignment scenario

You have applied for a post as a trainee with a software development company and have been invited for
an interview. You have been asked to demonstrate your problem solving and basic programming skills. To
do this you have to prepare a report on using algorithms to solve problems.
You need to explain, using examples, how algorithms are used to solve simple business problems and the
steps needed to be followed to produce a working program solution. You should make clear your
assumption about your program. The problems to be solved will involve basic procedural programming
instructions - sequence instructions (input, output and assignment statements), loops, conditional
statements. Problems should be analysed and designed by the use of flowchart and demonstrated by the
use of modules (procedures).
Tasks:

 State your simple business problems to be solved.


 Analyse the problem and design the solutions by the use of suitable methods.
 Demonstrate the compilation and running of a program
 Evaluate how the problem is solved from the designed algorithm to the execution program
written by a specific programming language.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application

P1 Provide a definition of what M1 Determine the steps taken from D1 Examine the implementation
an algorithm is and outline the writing code to execution. of an algorithm in a suitable
process in building an language. Evaluate the
application. relationship between the written
algorithm and the code variant.
Table of Contents
P1. Provide a definition of what an algorithm is and outline the process in building an application. ...... 1
1. Algorithm definition: ............................................................................................................................ 1
1.1 Definition .......................................................................................................................................... 1
1.2 Example : Solve quadratic equations by algorithm ..................................................................... 2
1.2.1 Flowchart ............................................................................................................................. 2
1.2.2 Pseudo Code ......................................................................................................................... 3
2. The procesess in building an application ............................................................................................ 4
2.1 STEPS IN Program Development: Analyzing or Defining the Problem .................................. 4
2.2 STEPS IN Program Development: Design ................................................................................... 6
2.3 STEPS IN Program Development: Coding ................................................................................... 9
2.4 STEPS IN Program Development: Documenting the Program.................................................. 9
2.5 STEPS IN Program Development: Testing .................................................................................. 9
2.6 STEPS IN Program Development: Debugging ............................................................................. 10
2.7 STEPS IN Program Development: Maintenance ......................................................................... 10
ASSIGNMENT 1 ANSWERS

P1. Provide a definition of what an algorithm is and outline the process in building an application.
1. Algorithm definition:
1.1 Definition
In mathematics and computer science, an algorithm (/ˈælɡərɪðəm/ (About this soundlisten)) is a
finite sequence of well-defined, computer-implementable instructions, typically to solve a class of
specific problems or to perform a computation. Algorithms are always unambiguous and are used as
specifications for performing calculations, data processing, automated reasoning, and other tasks. In
contrast, a heuristic is a technique used in problem solving that uses practical methods and/or various
estimates in order to produce solutions that may not be optimal but are sufficient given the
circumstances.
As an effective method, an algorithm can be expressed within a finite amount of space and time, and
in a well-defined formal language for calculating a function. Starting from an initial state and initial
input (perhaps empty), the instructions describe a computation that, when executed, proceeds through a
finite number of well-defined successive states, eventually producing "output"[ and terminating at a
final ending state. The transition from one state to the next is not necessarily deterministic; some
algorithms, known as randomized algorithms, incorporate random input.
The concept of algorithm has existed since antiquity. Arithmetic algorithms, such as a division
algorithm, were used by ancient Babylonian mathematicians c. 2500 BC and Egyptian mathematicians
c. 1550 BC. Greek mathematicians later used algorithms in 240 BC in the sieve of Eratosthenes for
finding prime numbers, and the Euclidean algorithm for finding the greatest common divisor of two
numbers. Arabic mathematicians such as al-Kindi in the 9th century used cryptographic algorithms for
code-breaking, based on frequency analysis.
The word algorithm itself is derived from the name of the 9th-century mathematician Muḥammad
ibn Mūsā al-Khwārizmī, whose nisba (identifying him as from Khwarazm) was Latinized as Algoritmi.
A partial formalization of the modern concept of algorithm began with attempts to solve the
Entscheidungsproblem (decision problem) posed by David Hilbert in 1928. Later formalizations were
framed as attempts to define "effective calculability" or "effective method". Those formalizations
included the Gödel–Herbrand–Kleene recursive functions of 1930, 1934 and 1935, Alonzo Church's
lambda calculus of 1936, Emil Post's Formulation 1 of 1936, and Alan Turing's Turing machines of
1936–37 and 1939.

Page |1
1.2 Example : Solve quadratic equations by algorithm
1.2.1 FlowChart

Page |2
Exphain the flowchar
a b c delta x1 x2 are variables.
Input a,b,c is asking user to enter a,b,c.
delta=b*b-4*a*c.
If delta=0 true, x1 = x2 = -b / 2 * a.
Else if delta>0 true, x1 = -b + Sqrt(delta) / 2 * a x2 = -b - Sqrt(delta) / 2 * a.
Else delta<0 true, the equation has no solution.
Output is output to screen value x.
1.2.2 Pseudo Code

Page |3
2. The procesess in building an application
2.1 STEPS IN Program Development: Analyzing or Defining the Problem
 The problem is defined by doing a preliminary investigation
 Defining a problem helps us to understand problem clearly
 It is also known as Program Analysis
Tasks in defining a problem
 Followings are the tasks in order to define a problem
- Specifying the input requirements
- Specifying the output requirements
- Specifying the processing requirements
 The processing requirement is obtained by answering following questions
- What is the method (technique) required in producing the desired output?
- What are the validation checks that need to be applied to the input data?
- What calculations are needed?
 The output specification is obtained by answering the following questions
- What values will be produced?
- What is the format of these values?
- What specific annotation, headings, or titles are required in the report?
- What is the amount of output that will be produced?
 The processing requirement is obtained by answering following questions
- What is the method (technique) required in producing the desired output?
- What are the validation checks that need to be applied to the input data?
- What calculations are needed?
Activity: Find Factorial Number
- Input: Positive integer number
- Output: Factorial of that number
- Process: Solution technique which transforms input to output.
- Factorial of a number can be calculated by the formula n!=1*2*3*…*n

Page |4
Use-case diagram
 Use case diagrams are used to gather the requirements of a system
 So when a system is analyzed to gather its functionalities use cases are prepared and actors are
identified.
 The purposes of use case diagrams can be as follows:
- Used to gather requirements of a system
- Used to get an outside view of a system
- Identify external and internal factors influencing the system
- Show the interacting among the requirements are actors
Main elements of use-case diagram

Page |5
Activity: Draw use-case diagram
 You are hired to develop FAI’s library system with following description
 Admin who could – Manage books, readers (staff, lecturers, and students), etc. – Manage
borrow/return books
 Users (staff, lecturers, students) who could – View/search books – Reserve books –
Borrow/return books
 Please draw Use-case diagram for this scenario
2.1 STEPS IN Program Development: Design
Flowchart is a diagrammatic representation of an algorithm
It uses different symbols to represent the sequence of operations, required to solve a problem
It serves as a blueprint or a logical diagram of the solution to a problem
Modular Design
 Once the problem is defined clearly, several design methodologies can be applied
 An important approach is Top-Down program design
 It is structured design technique
- It breaks up the problem into a set of sub-problems called
- Modules
- It creates a hierarchical structure of the modules
Flowchart
 Flowchart is a diagrammatic representation of an algorithm
 It uses different symbols to represent the sequence of operations, required to solve a problem
 It serves as a blueprint or a logical diagram of the solution to a problem

Page |6
Flowchart symbols

Page |7
Activity: Drawing flowchar
• Draw a flowchart for the algorithm to find factorial number in previous activity

Page |8
2.2 STEPS IN Program Development: Coding
 An algorithm expressed in programming languages is called Program
 Writing a program is called Coding
 The logic that has been developed in the algorithm is used to write program
2.3 STEPS IN Program Development: Documenting the Program
 Document explains
- How the program works and how to use the program (user manual)
- How to maintain the program (developer manual)
 Details of particular programs, or particular pieces of programs, are easily forgotten or confused
without suitable documentation
Forms of documentation
 Documentation comes in two forms
- External documentation, which includes things such as reference manuals, algorithm
descriptions, flowcharts, and project workbooks
- Internal documentation, which is part of the source code itself (essentially, the declarations,
statements, and comments)
Compiling and Executing the Program
 Compilation is a process of translating a source program into machine understandable form
 The compiler is system software – It examines each instruction for its correctness – It does the
translation
 During the execution – Program is loaded into the computer’s memory – The program
instructions are executed
2.4 STEPS IN Program Development: Testing
 Testing is the process of executing a program with the deliberate intent of finding errors
 Testing is needed to check whether the expected output matches the actual output
 Testing is done during every phase of program development
 Initially, requirements can be tested for its correctness
 Then, the design (algorithm, flow charts) can be tested for its exactness and efficiency
Test criteria
 Programs are tested with several test criteria and the important ones are given below

Page |9
- Test whether each and every statement in the program is executed at least one (Basic path
testing)
- Test whether every branch in the program is traversed at least once (control flow)
- Test whether the input data flows through the program and is converted to an output (data
flow)
2.5 STEPS IN Program Development: Debugging
 Debugging is a process of correcting the errors
- Programs may have logical errors which cannot be caught during compilation
- Debugging is the process of identifying their root causes One of the ways is to print out the
intermediate results at strategic points of computation
- Another way is to use support from the IDE • Testing vs Debugging
- Testing means detecting errors
- Debugging means diagnosing and correcting the root causes
2.6 STEPS IN Program Development: Maintenance
 Program maintenance
- Continuing process of maintenance and modification
- To keep pace with changing requirements and technologies
 Maintainability of the program is achieved by
- Modularizing it
- Providing proper documentation for it
- Following standards and conventions (naming conventions, using symbolic constants, etc.)

P a g e | 10
REFERENCES

Minsky (1967), Savage (1987) and Gurevich (2000), 2021. Algorithm - Wikipedia. [online]
En.wikipedia.org. Available at:
https://en.wikipedia.org/wiki/Algorithm
[Accessed 29 September 2021].

René Descartes and La Géométrie, 2021. Quadratic equation - Wikipedia. [online] En.wikipedia.org.
Available at:
https://en.wikipedia.org/wiki/Quadratic_equation
[Accessed 30 September 2021].

Shaddy, 2021. Algorithm and Flowchart to find all the Roots of a Quadratic Equation. [online]
Atechdaily.com. Available at:
https://atechdaily.com/posts/algorithm-to-find-all-the-roots-of-a-quadratic-equation
[Accessed 30 September 2021].

Alan B. Sterneckert, Andrew Veronis and Marilyn Bohl and Mark A. Fryman, 2021. What is a
Flowchart. [online] Lucidchart. Available at: https://www.lucidchart.com/pages/what-is-a-flowchart-
tutorial

[Accessed 30 September 2021].

Agans, David J., 2021. Debugging - Wikipedia. [online] En.wikipedia.org. Available at:
https://en.wikipedia.org/wiki/Debugging

[Accessed 30 September 2021].

Van Deursen, A., Klint, P. and Visser, J., 2000. Domain-specific languages: An annotated
bibliography. ACM Sigplan Notices, 35(6), pp.26-36.

Hejlsberg, A., Wiltamuth, S. and Golde, P., 2006. The C# Programming Language. Microsoft• net
Development Series.

P a g e | 11

You might also like