7388 - GCD1105 - ASM1 - Pham Thi Thanh Thien - GCD210520
7388 - GCD1105 - ASM1 - Pham Thi Thanh Thien - GCD210520
7388 - GCD1105 - ASM1 - Pham Thi Thanh Thien - GCD210520
GCD1105
Class Assessor name Pham Thanh Son
Student declaration
I certify that the assignment submission is entirely my 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
lOMoAR cPSD| 10095830
lOMoAR cPSD| 10095830
Contents
Table of Contents
1. Task 1 - State your simple business problems to be solved (P1). ......................................................................................... 5
1.1. Overview of Algorithm.................................................................................................................................................... 5
Advantages of Algorithms: ..................................................................................................................................................... 6
Disadvantages of Algorithms: ................................................................................................................................................ 6
1.2. State a small problem, input, and output. ..................................................................................................................... 7
2. Task 2 - Analyse the problem and design the solutions by the use of suitable methods (P1). .......................................... 7
2.1. Analyse the problem. ....................................................................................................................................................... 7
2.2. Flowchart. ........................................................................................................................................................................ 7
3. Task 3 - Demonstrate the compilation and running of a program (P2 – ............................................................................ 9
3.1. Source code and screenshots of the final result. ........................................................................................................... 9
3.2. Explain code. .................................................................................................................................................................. 10
3.2.1. Input number needs to check. ...................................................................................................................................... 10
3.2.2. Check inputted whether > 0 or not. ............................................................................................................................. 11
3.2.3. After inputting number > 0, check if it is divisible for 2 or not. ................................................................................ 12
3.2.4. Further function: Ask users if they want to continue to check another number and Clear screen. ...................... 13
3.3. Explain briefly what is Software Development Life Cycle. ....................................................................................... 14
3.3.1. Identify the Current Problems. .................................................................................................................................... 14
3.3.2. Plan. ................................................................................................................................................................................ 14
3.3.3. Architechture Design..................................................................................................................................................... 15
3.3.4. Software Development. ................................................................................................................................................. 15
3.3.5. Testing. ........................................................................................................................................................................... 15
3.3.6. Deployment. ................................................................................................................................................................... 15
3.4. Explain how the source code is compiled. ................................................................................................................... 15
4. Procedural, object-oriented, and event-driven models, their characteristics, and the relationship between them.(P3)
................................................................................................................................................................................................. 18
4.1 Procedural programing......................................................................................................................................................... 18
4.2 Object-oriented programming (OOP) ................................................................................................................................. 18
4.3 Event-driven programming .................................................................................................................................................. 20
4.4 The relationship between procedural, object-oriented and event-oriented programming........................................... 25
5. Reference list. ......................................................................................................................................................................... 26
lOMoAR cPSD| 10095830
Figure 1: Algorithm.
To make the recipe, one would not follow any written directions, but simply the customary
ones. Similarly, not all written computer instructions are algorithms. For a set of instructions to be
considered an algorithm, it must meet the following criteria:
Clear and Unambiguous: The algorithm should be simple and straightforward. Each of
its phases should be distinct in every way and lead to a single conclusion.
Well-Defined Inputs: If an algorithm requires inputs, they should be well-defined.
Well-Defined Outputs: The algorithm must clearly specify and well-define the output
lOMoAR cPSD| 10095830
Figure 2: Characteristics.
Advantages of Algorithms:
It is simple to comprehend.
he description of the solution to a problem is called an algorithm.
The problem is broken down into smaller bits or stages in an algorithm, making it easier
for the programmer to turn it into a program.
Disadvantages of Algorithms:
Writing algorithms takes a long time, so it takes a long time to complete the program and there
will be a lot of errors.
Algorithms make it harder to demonstrate branching and looping statements.
lOMoAR cPSD| 10095830
Input Output
77 77 not divisible by 2
Solve: In this issue, we will use the if function, there is one more if function inside. Also, use
some simple syntax like import and export.
2. Task 2 - Analyse the problem and design the solutions by the use of
suitable methods (P1).
2.1. Analyse the problem.
To solve this problem, we need the syntax to be able to enter the number to be checked. Then
there will be another syntax to see if it is bigger than zero. After checking that the number is not
negative, we will have 2 small cases. Divisible by 2 and not divisible by 2. To do this, we use the
remainder "%" division sign. For example: 8 % 2 = 0. That means that 8 is divisible by 2.
2.2. Flowchart.
lOMoAR cPSD| 10095830
Figure 4: Flowchart.
lOMoAR cPSD| 10095830
Next, we will check the numbers we just entered whether they are bigger than 0. There will
be 2 cases:
* If it is greater than 0, they run another if loop.
* If it is less than 0, we will say that the number is not valid.
lOMoAR cPSD| 10095830
3.2.4. Further function: Ask users if they want to continue to check another number
and Clear screen.
We will use the Do-while function to ask the user if they want to continue.
This Do-while function will run once before checking the condition, so it will run the
program.
Towards the end of the program, we will ask if they want to continue:
* If yes, enter 'y' to continue. When the variable ='y' true to the condition, it
will continue to run.
* Otherwise, the program will stop and complete.
I also add function clear screen: Console.Clear(). In order to easy to see and tangle
free.
lOMoAR cPSD| 10095830
After the IL code is generated, we still don't have anything for our processor to read. After
lOMoAR cPSD| 10095830
that, it will convert the IL code to machine codes. The name for that something is
the Common Language Runtime or CLR.
CLR is a program running on your computer that manages the execution of IL code. It uses
a just-in-time, or JIT, a compiler to translate the IL code into machine code (sometimes
called "native" code). (Codeasy, n.d.)
To boil it down, let's take a look at the path your code takes from being written to being
run:
lOMoAR cPSD| 10095830
Advantages
• The programmed simplicity, as well as the ease of implementation of compilers and interpreters,
make procedural programming ideal for general-purpose programming.
• A wide range of books and online course materials on tested algorithms are available, making it easy
to study as you go.
• Because the source code is portable, it can also be used to target a different CPU.
• The code can be reused without having to copy it in different portions of the software.
• The memory required is also reduced using the Procedural Programming technique.
• The program flow can be simply followed. (Bhatia,
2021)
lOMoAR cPSD| 10095830
Disadvantages
• The main disadvantage of procedural programming is that it does not run as fast compared to code
written in a lower level language. For applications that require a lot of processing power, this can limit the
efficiency of procedural programming.
• Relationships with real-world objects are difficult.
• Activity takes precedence over data, which can cause problems in data-sensitive situations.
Abstraction: This is the ability of the program to ignore or ignore some aspects of the information
it is directly working on, i.e. it's ability to focus on the core needs set. Each object serves as an
"animal" that can internally complete tasks, report, change its state, and communicate with other
objects without telling how the object is handled. can perform operations. This property is often
referred to as data abstraction.
Encapsulation and information hiding: This property does not allow the user of the object to
change the internal state of an object. Only the internal methods of the object allow to change its
state. How the external environment is allowed to affect an object's internal data is entirely up to
the coder. This property ensures the integrity of the object.
Polymorphism: Expressed through sending messages (message). Sending these messages is
comparable to calling the internal functions of an object. The methods used to respond to a
message will respond differently depending on the object to which the message is sent. The
programmer can define a property (for example, by method names) for a series of close objects,
but when implementing the same name, the implementation of each object will be automatic.
occurs according to the characteristics of each object without confusion.
Inheritance: This property allows an object to have properties that another object already has
through inheritance. This allows objects to share or extend existing properties without having to
redefine them. However, not all object-oriented languages have this property.
* Features of object-oriented programming:
Easily manage code when there are program changes.
Ease of project expansion.
Significant resource savings for the system.
Has high security.
Highly reusable.
It has the ability to chart objects.
Allows to classify objects into different classes.
Encapsulation:
lOMoAR cPSD| 10095830
Inheritance:
Polymorphism
Abstraction:
lOMoAR cPSD| 10095830
Constructor:
5. Reference list.
Bibliography
* Wikipedia: https://en.wikipedia.org/wiki/Algorithm
https://en.wikipedia.org/wiki/Object-oriented_programming
https://en.wikipedia.org/wiki/Event-driven_programming
https://www.geeksforgeeks.org/introduction-to-algorithms/
https://viblo.asia/p/vong-doi-va-quy-trinh-phat-trien-phan-mem-phan-1-07LKXmwrZV4
https://freecontent.manning.com/how-is-c-compiled/
https://hackr.io/blog/procedural-programming