Download Assignment for programming and more Assignments Assembly Language Programming in PDF only on Docsity!
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 1: Programming
Submission date 12/08/2020 Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name Tran Phuoc Thien Tam^ Student ID GCD
Class GCD0806^ Assessor name Mr. Minh Tran Trong
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 Thien Tam
Grading grid
P1 M1 D
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
Table of Contents
- Programming............................................................................................................................................................... - Something about Programming....................................................................................................................... - 1.1. Definition................................................................................................................................................. - 1.1.1. Instruct the computer...................................................................................................................... - 1.1.2. Perform various tasks...................................................................................................................... - 1.2. Scenario of the chosen system................................................................................................................ - 1.3. Algorithm................................................................................................................................................. - 1.3.1. Definition......................................................................................................................................... - 1.3.2. All Algorithms must satisfy the following criteria............................................................................. - 1.3.3. Properties of Algorithm.................................................................................................................... - 1.4. IDE............................................................................................................................................................ - 1.4.1. Visual Studio.................................................................................................................................... - 1.4.2. Debugger........................................................................................................................................ - Design............................................................................................................................................................ - 2.1. Hierarchy diagram:................................................................................................................................ - 2.2. Flowchart............................................................................................................................................... - Code............................................................................................................................................................... - 3.1. Pseudo-code.......................................................................................................................................... - 3.2. Code for program................................................................................................................................... - 3.3. Test and debug...................................................................................................................................... - 3.3.1. Testing............................................................................................................................................ - 3.3.2. Testing data case............................................................................................................................
- Reference..............................................................................................................................................................
- Index of comments................................................................................................................................................
- Figure 1: Example about Algorithm............................................................................................................................. Table of Figures
- Figure 2: Definition about Algorithm...........................................................................................................................
- Figure 3: Visual Studio 2019........................................................................................................................................
- Figure 4: Example about debugging tool...................................................................................................................
- Figure 5: Hierarchy diagram......................................................................................................................................
- Figure 6: Flowchart for menu....................................................................................................................................
- Figure 7: Code for program.......................................................................................................................................
- Figure 8: Display menu..............................................................................................................................................
- Figure 9: Display the price entered............................................................................................................................
- Figure 10: Display the sale price................................................................................................................................
- Figure 11: Calculate the profit...................................................................................................................................
- Figure 12: Exit............................................................................................................................................................
- Figure 13: Input price entered Fail.............................................................................................................................
- Figure 14: Input price entered Pass...........................................................................................................................
- Figure 15: Input your choice Fail................................................................................................................................
- Figure 16: Input your choice Fail................................................................................................................................
1.2. Scenario of the chosen system
Currently in the 4.0 era, Programming is always an essential part of many fields, including business,
healthcare, education, etc. People have used the Programming in daily life, but most of them don't know
how to create it and how it work.
As a trainee with a software development company. I will make a program to show to everybody my
demonstrate problem solving and basic programming skills.
Imagine, how would a company operate without the benefits of programming. Everyone has to work on
paper without a computer, which is very inconvenient. So now I'm going to create an employee
management program that makes it easier for everyone to work. So how to create a complete program?
I will use multiple Algorithm.
Figure 1: Example about Algorithm 1.3. Algorithm
1.3.1. Definition
In mathematics and computer science, an algorithm is a finite sequence of well-defined, computer-
implementable instructions, typically to solve a class of 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.
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. (Weisstein, n.d.)
For the purpose of computing, algorithms are written in pseudocode, flow charts, or programming
languages.
Figure 2: Definition about Algorithm
1.3.2. All Algorithms must satisfy the following criteria
Input: The algorithm must have input values from a specified set.
Output: The algorithm must produce the output values from a specified set of input values. The
output values are the solution to a problem.
Finiteness: For any input, the algorithm must terminate after a finite number of steps.
Definiteness: All steps of the algorithm must be precisely defined.
Effectiveness: It must be possible to perform each step of the algorithm correctly and in a finite
amount of time.
1.3.3. Properties of Algorithm
Simply writing the sequence of instructions as an algorithm is not sufficient to accomplish certain
task. It is necessary to have following properties associated with an algorithm.
Non Ambiguity: Each step in an algorithm should be non-ambiguous. That means each
instruction should be clear and precise. The instruction in any algorithm should not denote
any conflicting meaning. This property also indicates the effectiveness of algorithm.
Range of Input: The range of input should be specified. This is because normally the algorithm
is input driven and if the range of input is not being specified then algorithm can go in an
infinite state.
Multiplicity: The same algorithm can be represented into several different ways. That means
we can write in simple English the sequence of instruction or we can write it in form of
pseudo code. Similarly, for solving the same problem we can write several different
algorithms.
Speed: The algorithm is written using some specified ideas. Bus such algorithm should be
efficient and should produce the output with fast speed.
1.4.2. Debugger
A debugger or debugging tool is a computer program used to test and debug other programs (the
"target" program). The main use of a debugger is to run the target program under controlled conditions
that permit the programmer to track its operations in progress and monitor changes in computer
resources (most often memory areas used by the target program or the computer's operating system)
that may indicate malfunctioning code. Typical debugging facilities include the ability to run or halt the
target program at specific points, display the contents of memory, CPU registers or storage devices (such
as disk drives), and modify memory or register contents in order to enter selected test data that might
be a cause of faulty program execution. (Rosenberg, n.d.)
Figure 4: Example about debugging tool
2. Design
2.1. Hierarchy diagram:
A hierarchy diagram (also called a tree diagram) classifies information by starting with broad categories
and narrowing down to more detailed levels.
The hierarchy can be presented in a vertical or horizontal format and can include multiple levels of
information as needed. A common use of the vertical format is an organization chart.
Because of the problem of scenario is input data and store data, show data in screen and exit. So I will
divide the program to 4 elements. But because of user is merchant, having Price entered and Sale price
so the program is divided to 3 elements are:
Input Price entered
Input Sale price
Show profit
In show data function has 4 elements are:
Show Price entered
Show Sale price
Show total profit
Exit
Figure 5: Hierarchy diagram 2.2. Flowchart
Flowchart for menu:
Figure 6: Flowchart for menu
3.2. Code for program Figure 7: Code for program
3.3. Test and debug
3.3.1. Testing
Ex: Input price entered is 3 and sale price is 5
So the menu is:
Figure 8: Display menu
Choose your choice:
Press 1 to display the price entered:
Figure 9: Display the price entered Press 2 to display the sale price:
3.3.2. Testing data case
Test case number Subjects to be inspected Pre-condition Step to take Input data Expected output Actual output Status Image 1 Input price entered Price entered is an integer +Press a a Input the number of price entered: a Input the number of price entered: a Please input again! Fail (Figure 13) 2 Input price entered Price entered is an integer +Press 3 3 Input the number of price entered: 3 Input the number of price entered: 3 Pass (Figure 14) 3 Input your choice Choice=x|| 0<x<5|| x is an integer +Press 5 5 Choose your selection: 5 Choose your selection: 5 Please Input from 1 to 4! Fail (Figure 15) 4 Input your choice Choice=x|| 0<x<5|| x is an integer +Press a a Choose your selection: a Choose your selection: a Please Input number! Fail (Figure 16) Table 1: Testing data case Figure 14: Input price entered Fail
Figure 15: Input price entered Pass Figure 16: Input your choice Fail Figure 17: Input your choice Fail
Index of comments