You are on page 1of 29

BTEC FPT INTERNATIONAL COLLEGE

INFORMATION TECHNOLOGY
ASSIGNMENT 1
UNIT: PROGRAMMING

STUDENT : HUYNH TAN LUONG


CLASS : SE06202
STUDENT ID : BD00357
SUPERVISOR : NGUYEN HOANG ANH VU

DaNang, June 2023


ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 4 HND Diploma in Computing

Unit number and title Unit: Programming

Date received (1st sub-


Submission date 19/06/2023 26/06/2023
mission)

Date received (2nd sub-


Re-submission date
mission)

Student name HUYNH TAN LUONG Student ID BD00357

NGUYEN HOANG ANH


Class SE06202 Assessor name
VU

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the con-
sequences of plagiarism. I understand that making a false declaration is a form of malpractice.

Student’s signature:

TAN LUONG

Grading grid

P1 M1 D1
Summative Feedbacks: Resubmission Feedbacks:

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

Signature & Date:

i
TABLE OF CONTENT

TABLE OF CONTENT.................................................................................................................ii

LIST OF TABLES AND FIGURES.................................................................................................iii

LIST OF ACRONYM...................................................................................................................iv

INTRODUCTION........................................................................................................................1

CHAPTER 1 BASIC KNOWLEDGE.......................................................................................2

1 Provide a definition of what an algorithm is and outline the process in building an ap -


plication (P1).....................................................................................................................................2

1.1.1 Definition.............................................................................................................2

1.1.2 Give an example of algorithms in real life...........................................................3

1.2 Ways to demonstrate algorithms...............................................................................6

1.2.1 What is pseudocode?..........................................................................................6

1.2.2 Flowchart Analysis Algorithm Presentation:.......................................................7

1.3 Characteristic of Algorithms.....................................................................................10

1.3.1 features of the algorithm...................................................................................10

1.3.2 advantages and disadvantages of the algorithm...............................................11

1.3.3 Steps to write a good algorithm........................................................................12

1.4 Steps in program development................................................................................13

CONCLUSION..........................................................................................................................21

REFERENCES...........................................................................................................................22

ii
LIST OF TABLES AND FIGURES

Figure:1- 1 algorithm................................................................................................................2

Figure:1- 2 Prepare the ingredients.........................................................................................3

Figure:1- 3 Heat a pot or pan on the stove..............................................................................3

Figure:1- 4 Pour cooking oil into a pot or pan..........................................................................4

Figure:1- 5 Place the sausages slowly in the pot or pan..........................................................4

Figure:1- 6 Fry sausages in cooking oil.....................................................................................5

Figure:1- 7 Remove the sausage from the pot or pan.............................................................5

Figure:1- 8 Put the fried sausage on a plate............................................................................6

Figure:1- 9 pseudocode to find the largest number................................................................7

Figure:1- 10 Flowchar..............................................................................................................8

Figure:1- 11 Example: Decision Flowchart for Lot Setup.........................................................9

Figure:1- 12 Simple diagram example......................................................................................9

Figure:1- 13 advantages and disadvantages of the algorithm...............................................11

Figure:1- 14 C#.......................................................................................................................14

Figure:1- 15 visual studio.......................................................................................................15

Figure:1- 16 simple registration program Flowchar..............................................................16

Figure:1- 17 Source code........................................................................................................17

Figure:1- 18 error input missing string function...................................................................17

Figure:1- 19 Error missing "{" of static void Main(string[] args)............................................18

Figure:1- 20 The Main method...............................................................................................19

Figure:1- 21 program initialized successfully.........................................................................19

Figure:1- 22 program initialization failed...............................................................................20

iii
iv
LIST OF ACRONYM

ACL Access Control List

ADSL Asymmetric Digital Subscriber Line

ARCNET Attached Resource Computer Network

ARP Address Resolution Protocol

Bit Binary Digit

DHCP Dynamic Host Configuration Protocol

DHCS Dynamic Host Configuration Server

DNS Domain Name System

v
INTRODUCTION

Programming plays a very important role in life. It will help us understand more deeply, what an
algorithm is, understand programming models such as procedural programming, object-oriented
programming, the structure of a program, data, basic data, and introduce

Give students knowledge of IDE rules of naming in code. At the same time, helping students have
the knowledge to build basic applications Coming to this report, we will learn about algorithms,
problems related to algorithms and basic programming. Let's find out in this assignment!

Perfomed Student: HUYNH TAN LUONG 1


CHAPTER 1 BASIC KNOWLEDGE

LO1 Define basic algorithms to carry out an operation and outline the process of pro-
gramming an application.

1 Provide a definition of what an algorithm is and outline the process in building an ap-
plication (P1)

1.1.1 Definition

An algorithm is a set of instructions or procedures designed to solve a problem or perform


a specific task. An algorithm is a specific method and can be used to solve problems in many differ-
ent fields, such as mathematics, computer science, information technology, and many other indus-
tries.

The algorithm consists of specific and explicit steps, each of which has a certain effect and
conditions to perform. It can include basic math operations, conditional statements, loops, and
uses input data to produce the desired output.

The goal of an algorithm is to provide an efficient and accurate process for solving a prob-
lem or performing a task. It provides a clear instruction to take steps and process information in a
structured way, helping to achieve the desired result.Algorithms can be written and implemented
in many different programming languages and can run on different computers or systems.

Figure:1- 1 algorithm

Perfomed Student: HUYNH TAN LUONG 2


1.1.2 Give an example of algorithms in real life

 Simple sausage frying algorithm


Step 1:

Prepare the necessary ingredients and tools: sausage, cooking oil, pot or pan, stove, plate,
paper or towel.

Figure:1- 2 Prepare the ingredients

Step 2:

Heat a pot or pan over medium heat. Make sure the pot or pan is large enough to comfort-
ably hold the sausage.

Figure:1- 3 Heat a pot or pan on the stove

Perfomed Student: HUYNH TAN LUONG 3


Step 3:

Fill a pot or pan with enough oil to cover the sausages while cooking. Wait for the oil to
reach frying temperature, which can be tested by dropping a small piece of sausage into the pot. If
it makes a sizzling sound and starts to brown, the oil has reached the right temperature.

Figure:1- 4 Pour cooking oil into a pot or pan

Step 4:

Place the sausages slowly into the pot or pan. Take care to avoid hot oil spray. Arrange the
sausages so that they don't overlap and have space between them to spread the heat evenly.

Figure:1- 5 Place the sausages slowly in the pot or pan

Step 5:

Perfomed Student: HUYNH TAN LUONG 4


Fry sausages in oil until brown and crispy on the outside. If the sausage is fresh and pre-
cooked, this usually takes about 5-7 minutes. Toss the sausages often to make sure they cook
evenly and don't burn.

Figure:1- 6 Fry sausages in cooking oil

Step 6:

Use a rack to remove the sausages from the pot or pan. Let the sausage drain for a few sec-
onds to remove excess oil.

Figure:1- 7 Remove the sausage from the pot or pan

Step 7:

Place the fried sausages on a plate covered with paper towels or washcloths to absorb ex-
cess oil. Serve hot fried sausages, garnish with ketchup, green onions, or seasonings to your liking.

Perfomed Student: HUYNH TAN LUONG 5


Figure:1- 8 Put the fried sausage on a plate

1.2 Ways to demonstrate algorithms

1.2.1 What is pseudocode?

Pseudocode is an emulator language that uses programming conventions to describe the


algorithm or logic of a program without mentioning the specific syntax of a particular program-
ming language. It is used to present an algorithm in a way that is clear, understandable to the
reader, and can be translated into an actual programming language.

Pseudocode is usually written in natural language, using keywords, simple syntax, and sim-
ple formatting conventions to describe the steps in the algorithm. It does not require precise syn-
tactic details, but focuses on presenting the logic of the algorithm in a clear and understandable
manner.

Pseudocode helps programmers and readers understand the logic of an algorithm without
worrying about the syntactic details of specific programming languages. It also helps in the analy -
sis, design and presentation of algorithms before implementing them in a particular programming
language.

Here's an example of pseudocode for a simple algorithm that finds the maximum number
in a list of integers:

In this pseudocode, we define a function called findMaximum that takes a list as input. The
function first checks if the list is empty and returns an appropriate message if it is. Otherwise, it as -
sumes that the first number in the list is the maximum and iterates through the remaining num-

Perfomed Student: HUYNH TAN LUONG 6


bers in the list. If a number greater than the current maximum is found, it updates the maxNum-
ber variable. Finally, the function returns the maximum number found.

Note that this pseudocode does not specify the syntax of a specific programming language
but focuses on expressing the logical steps involved in finding the maximum number. It can be eas-
ily translated into actual code in a programming language of your choice.

Figure:1- 9 pseudocode to find the largest number

1.2.2 Flowchart Analysis Algorithm Presentation:

A flowchart, also known as a data flow diagram or process diagram, is a graphical tool used
to describe the process or workflow of a system, a workflow, or a program. computer. It provides
an intuitive way to understand and present the steps to be taken and the relationships between
those steps.

Flowcharts are commonly used in systems analysis, process design, programming, and
project management. It helps users to understand and clearly represent process steps, control
conditions and rules, expressions and data handlers.

Flowcharts are typically created using standard symbols and symbols to represent steps,
rules, and data flows. Commonly used symbols and symbols include rectangles to represent execu-
tion steps, circles to represent conditions, arrows to represent links between steps, and more.
Perfomed Student: HUYNH TAN LUONG 7
Using flowcharts, users can easily understand and analyze a process or program, detect er-
rors or optimize, and convey information clearly and uniformly to others.

Figure:1- 10 Flowchar

 Example: Decision Flowchart for Lot Setup

Figure:1- 11 Example: Decision Flowchart for Lot Setup

 Simple diagram example

Perfomed Student: HUYNH TAN LUONG 8


Figure:1- 12 Simple diagram example

1.3 Characteristic of Algorithms

1.3.1 features of the algorithm

An algorithm is a logical and ordered set of rules or instructions for solving a problem or
performing a particular task. It is a widely used method in the field of computer science and math -
ematics to solve problems of computation, searching, sorting, data processing, etc.

Here are the main features of the algorithm:

Input: Each algorithm takes a set of input values. This can be user input, data sets, or other
parameters that the algorithm needs to perform the computation.

Output: The algorithm must produce results after performing the calculation steps. This is
the expected result or goal that the algorithm should achieve based on the input data and the pro-
cessing rules.

Perfomed Student: HUYNH TAN LUONG 9


Clarity and Defining: An algorithm must be described in a clear and defined way. The steps
and rules of the algorithm must be defined correctly and easily understood so that others can im-
plement it without causing confusion.

Completeness: An algorithm must be designed to solve the specific problem it is targeting.


It must be able to handle all possible cases and give accurate results in all cases.

Efficiency: Algorithms need to be designed to work efficiently. This means it must use re-
sources such as time and memory optimally. Algorithm efficiency is often evaluated based on time
and space complexity.

Iterative Steps: An algorithm usually contains iterative steps to execute a process many
times until the exit condition is met. Iterative steps make it possible for an algorithm to efficiently
process large data sets or perform a task many times.

Problem Solving: The main goal of an algorithm is to solve a particular problem or perform
a task. The algorithm must provide the necessary steps to achieve this goal efficiently.

Language Independent: An algorithm is independent of any particular language. It can be


implemented and executed in many different programming languages.

1.3.2 advantages and disadvantages of the algorithm

Figure:1- 13 advantages and disadvantages of the algorithm

 Advantages of the algorithm:

Perfomed Student: HUYNH TAN LUONG 10


 Problem Solving: Algorithms provide a specific method for solving computational and
data processing problems. It allows us to find the most optimal and efficient way to per-
form a particular task.
 Reusability: Algorithms can be reused for similar problems in the future. Once an algo-
rithm has been thoroughly developed and tested, it can be applied and reused in a variety
of scenarios, saving development time and effort.
 Computational Efficiency: A good algorithm is designed to operate efficiently, using re-
sources such as time and memory optimally. Efficient algorithms help speed up process-
ing and reduce the load on computing and data analysis systems.
 Automation: Algorithms can be deployed in automation environments, allowing repetitive
tasks to be performed automatically and reliably. This reduces manual work and increases
performance.
 Interpretability: Algorithms can be easily understood and analyzed. The steps and rules of
the algorithm can be explained in a clear and uniform way, helping users to understand
the algorithm's process and results.
 Disadvantages of the algorithm:
 Limitation of Solution: An algorithm generates only one solution based on predefined
rules and procedures. It may not find optimal solutions in all cases and cannot change or
adapt to special situations.
 Complexity: Some algorithms can have high computational complexity, large resource re-
quirements, and long execution times. This can affect the performance and scalability of
the system.
 Depends on the input data: The performance of the algorithm can be affected by the na-
ture and structure of the input data. Sometimes, an algorithm may work well on a certain
data type, but not on other data types.
 Programming complexity: Some algorithms may require in-depth knowledge and high
programming skills to implement and execute. Wrong or incorrect implementation can
lead to errors or incorrect results.
 Changes and updates: If there is a change in requirements or the environment, the algo-
rithm may need to be adjusted or updated to meet the new requirements. This may re-
quire time and effort to make revisions and retests.

Perfomed Student: HUYNH TAN LUONG 11


1.3.3 Steps to write a good algorithm

- Steps to writing a good algorithm:


- Step 1: Obtain detailed information on the problem.
- Step 2: Analyze the problem.
- Step 3: Think of a problem-solving approach.
- Step 4: Review the problem-solving approach and try to think of a better
- alternative
- Step 5: Develop a basic structure of the Algorithm.
- Step 6: Optimize, Improve, and refine.

Problem Analysis: This step involves understanding the problem or task at hand and
identifying the requirements, constraints, and any other relevant information. It is important to
gather all the necessary details about the problem, including inputs, outputs, and any specific
requirements or limitations.

Design: In this step, a high-level design is created for the program. This includes outlining
the overall structure, modules, algorithms, data structures, and user interfaces. The design phase
helps in planning how the program will be organized and how different components will interact
with each other.

Implementation: The implementation phase involves writing the actual code for the
program based on the design. This is where the chosen programming language and platform are
used to translate the design into executable code. It involves using appropriate programming
constructs, such as functions, loops, and conditional statements, to implement the desired
functionality.

Testing: Once the code is implemented, it needs to be thoroughly tested. Testing involves
running the program with different inputs and scenarios to verify that it produces the expected
output and handles errors or exceptions correctly. This includes both unit testing, which tests
individual components or modules, and system testing, which tests the program as a whole.

Debugging: During testing, issues or bugs may be identified. The debugging phase involves
identifying and fixing these errors or bugs. It can be done using debugging tools, which help in
identifying the specific cause of the issue, or through manual inspection of the code to locate and
resolve the problem.

Perfomed Student: HUYNH TAN LUONG 12


Maintenance: After the program is deployed, it may require ongoing maintenance. This
includes fixing any issues or bugs that arise in the production environment, adding new features or
enhancements, and updating the program to adapt to changes in the operating environment or
user requirements. Maintenance ensures that the program remains functional and up-to-date
over time.

1.4 Steps in program development

 simple registration program


Step 1: Analyze and define the problem

Identify the problem to be solved: We need to build a simple registration program to col-
lect user information and register them into the system.

Define functional requirements: The program needs to ask the user for a name, email and
password, and then perform the user registration by calling the RegisterUser() method.

Defining Non-Functional Requirements: For this example, we will assume that registration
simply checks that all fields are not null.

Step 2: Create a solution (give an algorithm)

Program Algorithm:

Print out a welcome message and instruct the user to enter the registration information.

Use the Console.ReadLine() command to get the name, email, and password from the user.

Call the RegisterUser() method with the user information as arguments.

In the RegisterUser() method, check that all fields are not null. If true, return true to indi-
cate successful registration. Otherwise, return false.

Based on the results returned from RegisterUser(), print a successful or failed registration
message.

Here we will use C# language to design the program and visual studio to run the program

Perfomed Student: HUYNH TAN LUONG 13


Figure:1- 14 C#

Figure:1- 15 visual studio

Step 3: Design the program

User Interface Design: In this example, we use the simplest way to communicate with the
user via the command line. Use the Console.WriteLine() commands to print the message and Con -
sole.ReadLine() to get the user information.

Design the program structure: The program has two main methods:

Perfomed Student: HUYNH TAN LUONG 14


Main() method: Is the main control function of the program, where we will call other func-
tions to perform user registration and display the results.

RegisterUser() method: The function that registers the user. This function takes the user in-
formation and checks if they are valid.

Figure:1- 16 simple registration program Flowchar

Step 4: Programming

Program Code: The source code provided in the previous example is a complete version of
the program registered in C#.
Perfomed Student: HUYNH TAN LUONG 15
Figure:1- 17 Source code

Step 5: Debug the program

Syntax and logical error checking: Use the integrated development environment (IDE) or
compiler to check the program syntax and see if there are any logical errors. This includes testing
variables, conditional statements, and loops to see if they work as expected.

 error input missing string function

Figure:1- 18 error input missing string function

Perfomed Student: HUYNH TAN LUONG 16


The "string function declaration not found" error occurs when the program does not
recognize string as a valid data type. This error usually occurs when the using System script is
missing; at the top of the source code. To fix this error, you need to add the line using System; at
the beginning of the program's source code.

Command using System; Allows the program to use the classes and methods available in
the System namespace, including the string data type.

After adding the using System; line, the program will recognize string as a valid data type
and the "string function declaration not found" error will be resolved.

 Error missing "{" of static void Main(string[] args)

Figure:1- 19 Error missing "{" of static void Main(string[] args)

The error "character '{'" not found occurs when the program is missing the { sign after the
method declaration Main(string[] args). This error occurs because of a syntax error in the
declaration of the Main method. To fix this error, you need to add { right after the Main method
declaration.

The Main method in C# has the following syntax:

Perfomed Student: HUYNH TAN LUONG 17


Figure:1- 20 The Main method

The { after the Main method declaration marks the beginning of the Main method's
execution block. You need to make sure that { is added after the Main(string[] args) method
declaration to ensure valid syntax.

Step 6: Test

Perform functional testing: Run the program and check if the user registration works as
expected. Make sure to test with different input values to ensure that the program works properly
in all situations.

 program initialized successfully

Figure:1- 21 program initialized successfully

 program initialization failed

Perfomed Student: HUYNH TAN LUONG 18


Figure:1- 22 program initialization failed

Step 7: Deployment and Maintenance

Program Deployment: Copy or deploy the program to a real environment for use.

Maintenance and upgrades: Monitor the program post-deployment, fix bugs, and improve
functionality if necessary.

Perfomed Student: HUYNH TAN LUONG 19


CONCLUSION

After completing this report, I would like to thank Mr. Nguyen Hoang Anh Vu for his help,
.Thanks to him, I understand how the devices around us work. That is very interesting and won-
derful. Thank you my mentor!

Objectives and Research Question: they are well-defined and aligned with the current
knowledge and issues in the field of programming. And of course, they are specific and measur -
able, allowing for clear conclusions and further academic research.

Literature: The document is written in a comprehensive way, incorporating relevant ideas


and recent studies. It also identify the gaps between the existing studies and the academic con-
text.

Perfomed Student: HUYNH TAN LUONG 20


REFERENCES

1. https://aws.amazon.com/vi/what-is/sdlc/#:~:text=The%20software%20development%20life -
cycle%20(SDLC,expectations%20during%20production%20and%20beyond.
2. https://stackify.com/what-is-sdlc/
3. https://www.softwaretestinghelp.com/software-development-life-cycle-sdlc/
4. https://www.javatpoint.com/software-engineering-software-development-life-cycle
5. https://www.techtarget.com/searchsoftwarequality/definition/systems-development-life-cy -
cle

Perfomed Student: HUYNH TAN LUONG 21

You might also like