0% found this document useful (0 votes)
56 views10 pages

Assignment 1 - 1618 - Report

The document is an assignment front sheet for a BTEC Level 5 HND Diploma in Computing unit on programming. It includes the student's name, ID number, class, assessor name, and signatures. The student declares the assignment is their own work. Grading criteria and spaces are provided for summative and resubmission feedback from the assessor.

Uploaded by

zamui suki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views10 pages

Assignment 1 - 1618 - Report

The document is an assignment front sheet for a BTEC Level 5 HND Diploma in Computing unit on programming. It includes the student's name, ID number, class, assessor name, and signatures. The student declares the assignment is their own work. Grading criteria and spaces are provided for summative and resubmission feedback from the assessor.

Uploaded by

zamui suki
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

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 Nguyen Chau Toan Student ID GCD210174

Class GCD1102 Assessor name Nguyen Van Loi

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 Toan

Grading grid
P1 M1 D1

1
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:

2
Table of Contents
I. Overview about Algorithm with image illustration, explanation and example………….4
1. What is an Algorithm?............................................................................................4
2. Example an Algorithm………………………………………………………………………………………..4
2.1. Searching Algorithm……………………………………………………………………………….4
2.2. Sorting Algorithm……………………………………………………………………………………5
2.3. Represent a small, simple problem and solve this problem…………………….5
II. Analyze the problem and design the solutions by the use of suitable methods………..6
1. Analyze the problem…………………………………………………………………………………………..6
2. Flowchart……………………………………………………………………………………………………………6
III. Demonstrate the compilation and running of a program………………………………………….7
1. Introduce how the problem is solved………………………………………………………………….7
2. Source code and screenshots of the final result………………………………………………….8
3. Explain how the source code is compiled……………………………………………………………9
References………………………………………………………………………………………………………………………….10

Figure 1: Algorithm definitions

Figure 2: Example for a searching algorithm

Figure 3: Example for a sorting algorithm

Figure 4: Flowchart

Figure 5: Enter the coefficients

Figure 6: Use if-else statement for coefficient and delta

Figure 7: The result after entering three coefficients

Figure 8: Explain how the source code is compiled

3
I. Overview about Algorithm with image illustration, explanation and example

1. What is an Algorithm?

An algorithm is a set of directions for performing a task. For achieving a mission. For solving a
problem, an algorithm can be understood as a finite set of explicit instructions that the problem
solver can follow to solve the problem. Thus, the Algorithm is a method of expressing the
problem's solution - the concern.
In programming, there are six popular types of Algorithm: Search Algorithm, Sort Algorithm,
Link Analysis, Integer Factorization, Fourier Transform Algorithm, String Matching, and Pass
Algorithm.

Figure 1: Algorithm Definitions

2. Example Algorithms

2.1. Searching Algorithm


Linear search: This is a simple Algorithm in all search Algorithm. In this type of search,
the search process takes place continuously. Each element is checked, and if any match
is found, that particular element is returned; If not found, the search continues until all
data is found.

4
Figure 2: Example for a Searching algorithm

2.2. Sorting Algorithm

Selection sort: is a sorting algorithm that selects the smallest element from an unsorted
list in each iteration and places that element at the beginning of the unsorted list.

Figure 3: Example for a Sorting algorithm

2.3. Represent a small, simple problem and solve this problem


I have a quadratic equation (𝑎𝑥2 + 𝑏𝑥 + 𝑐 = 0) and three coefficient a = 4, b = -20 and c =
28. I don’t know how to find x. I will solve this problem with an algorithm, and it will
help me break it down into different cases. Moreover, make my coding easier.

5
II. Analyze the problem and design the solutions by the use of suitable methods

1. Analyze the problem


In this regard, I divide it into the following cases:

 a = 0, b = 0, c ≠ 0
The equation hasn’t solution.
 a = 0, b ≠ 0, c ≠ 0
The equation has a unique solution: x = -c / b
 a, b, c = 0
The equation has infinitely many solutions.

 a ≠ 0: In this situation, we go to find delta


Delta = b2 – 4ac, and we have three different case.
- Delta < 0: The equation hasn’t solution
- Delta > 0: The equation distinct solution (-b ± b2 – 4ac) / 2a
- Delta = 0: Equation with double roots x1 = x2 = -c / 2a

2. Flowchart

6
Figure 4: Flowchart

III. Demonstrate the compilation and running of a program

1. Introduce how the problem is solved

I make a small and simple program, then I will input 3 coefficients a = 4, b = -20, c = 28. Then
the program will help me to give the correct result. My little program is completed in C#
programming language.

7
2. Source code and screenshots of the final result

 The first part is to enter the coefficients

Figure 5: Enter the coefficients

 The second part is to considers coefficients and delta using if-else statement

8
Figure 6: Use if-else statement for coefficient and delta

 The result after entering three coefficients

Figure 7: The result after entering three coefficients

3. Explain how the source code is compiled


A compiler takes the program code (source code) and converts the source code to a
machine language module (called an object file). Another specialized program, called a
linker, combines this object file with other previously compiled object files (particularly run-
time modules) to create an executable file.

Source Compiler Object file


code

Runtime Linker
library files

Executable
file

Figure 8: Explain how the source code is compiled

9
References:
https://www.geeksforgeeks.org
https://www.w3resource.com

http://www.conceptdraw.com

10

You might also like