Uploaded by STEP UP

UNIT01 Programming

advertisement
Qualification
Unit Number and Title
Pearson BTEC HND in Computing
Unit 1: Programming
Student Name
Assessor Name
Gasif Imtiaz
Miss Qurat-ul-Ain
Hand in date
Assignment Title
Submit Policy
Early Finish Policy
Plagiarism
Guidelines
Competition Date
Submission Date
Design and implementation of classes, event programming, and
object-oriented code with a particular IDE.
This task must be finished on time. You must let your tutor know if
you run into any problems.
Students with good reasons for submitting late will be taken into
consideration (e.g. illness).
The rules of the college will be followed in cases of plagiarism. You
must sign the following declaration to certify that this assignment is
your original creation:
Learner Declaration
I attest that the work I've turned in for this assignment is all mine, and all of my research sources have
been properly cited.
Student signature:
1|Page
Date:
Contents
Context .......................................................................................................................................................... 4
Object Oriented Programming? .................................................................................................................... 4
Classes. .......................................................................................................................................................... 4
Event Driven Programming ........................................................................................................................... 4
LO 1 ............................................................................................................................................................... 5
1.1 Programming algorithm .......................................................................................................................... 5
1.1.1 Characteristics of Algorithm ................................................................................................................ 5
1.1.2 Algorithm types.................................................................................................................................... 5
1.2 Radix sort ................................................................................................................................................ 5
1.2.1 Radix sort in Pseudocode .................................................................................................................... 6
1.2.2 How Radix Sort Works ......................................................................................................................... 6
LO2 ................................................................................................................................................................ 8
2.1 Definition of Language Paradigm ............................................................................................................ 8
2.1.1 Programming Methodology of Imperative .......................................................................................... 8
2.1.2 Declarative-Based Programming ........................................................................................................ 8
2.2 Procedural Model ................................................................................................................................... 9
2.3 Object Oriented Concepts....................................................................................................................... 9
2.3.1 Data Security ...................................................................................................................................... 10
2.3.2 Inheritance ......................................................................................................................................... 10
2.3.3 Code Reusability................................................................................................................................. 10
2.3.4 Abstraction ......................................................................................................................................... 10
2.3.5 Models for event-driven programming ............................................................................................. 10
LO 3 ............................................................................................................................................................. 12
3.1 Implementation of the calculator in IDE ............................................................................................... 12
3.1.1 Code in C++ ........................................................................................................................................ 12
3.1.2 Code in C# IDE .................................................................................................................................... 14
3.1.3 Code in Pycharm IDE .......................................................................................................................... 15
LO 4 ............................................................................................................................................................. 16
4.1 An integrated development environment, or IDE, is what? ................................................................. 16
4.1.1 Source Code Editor ............................................................................................................................ 16
2|Page
4.1.2 Debugger ............................................................................................................................................ 16
4.1.3 Compiler ............................................................................................................................................. 16
4.1.4 Local Build Automation ...................................................................................................................... 16
4.1.5 Debugger ............................................................................................................................................ 16
4.2 Supported for Programming language ................................................................................................. 16
4.3 Plugin and Integration........................................................................................................................... 17
References ................................................................................................................................................. 18
3|Page
Context
Describe the term "object-oriented programming."
The OOP join the group of data attributes with designed function or OOP methods which can
accessed and modify by a path called an “Object”. OOP languages are based on classes and each
classes define its attributes of variables and attributes of functions. Multiple independent object
may be instantiated from the same class and interact with each other in complex way. Such as
Class of person that contain attributes e.g. person’s age, name, height, or etc.
Describe Classes.
Class is a fundamental block of a program that are designed for the specific module and for
inheritance. Class own set of methods and variables which can access by creating and instance.
Suppose about ordering system application. Class is descended into subclasses that perform the
modeling function. A class is an Ordering System. Ordering system class contain the variables and
functions. An ordering system is now an object because, after you input your order, it contains
data about you, your bank account, and the order details. You can now execute operations on an
object you made by using a class, such as order making time, Delivery time, or rider information.
These activities require methods from the class (Ordering System), but you cannot use them until
you make an object from them.
Event Driven Programming
In an event-driven programming paradigm, entities communicate with one another by passing
messages through a middleman. Even sensors are used to control events like temperature, water
flow, hardware control, and more. The API payment system, warehouse billing, order taking
applications, and other examples are all examples of event-driven programming in practice. For
instance, several producers and several consumers may work together to handle incoming requests.
Maintaining the history, managing user and producers, showing visualization or etc.
4|Page
LO 1
1.1 Algorithm for Programming.
An approach to problem-solving is a programming algorithm. It is built on instructing a series of
specific operations that, when performed by your computer, will always accomplish anything
exactly as you have instructed. An algorithm works by performing a series of steps based on input.
When it has adhered to all the inputs, it will observe a result, also known as an output.
1.1.1 Features of Algorithm:
1. Accuracy: The steps are outlined with great detail.
2. Uniqueness: Each step's results are specifically specified and solely rely on the input and
output of those that came before it.
3. Finiteness: After carrying out a certain amount of instructions, the technique ends.
4. Input: There is input provided to the algorithm.
5. Output: The algorithm produces results.
6. Simplification: The algorithm applies to a certain set of inputs and employs a specific set
of inputs.
1.1.2 Types of Algorithm

Sorting algorithms: Sorting techniques including Bubble Sort and Insertion Sort, among
others. These methods produce a specific format for sorting the data.

Searching algorithms Binary search and linear search are examples of search algorithms. The
user's desired value or record can be found using these techniques.

Graph Algorithms: Graph algorithms are used to solve problems like figuring out the quickest
path between cities and real-world problems like the challenge posed by travelling salespeople.
1.2 Radix Sort:
"The Radix sort is a sorting algorithm that first groups the individual digits with the same place
value before sorting the components. After that, arrange the components in ascending/descending
order.”
Let's assume that our array has 8 elements. The value of the unit place will first determine the order
of the items. Then the elements will be arranged in order of the value of the tenth position. Up
until the last big location, this continues.
5|Page
1.2.1 Bubble Sort in Pseudo code
1.2.2 How the Radix Sort Works:
UnsortedArr [ ]: {121,432, 564, 23, 1, 45, 788}
121
432
564
23
1
45
788
Sorting is started with the first two array elements, Comparing and checking which one is greater
1
2
1
0
0
1
0
0
1
0
0
1
1
2
1
0
2
3
4
3
2
0
2
3
0
4
5
0
2
3
4
3
2
1
2
1
5
6
4
0
4
5
4
3
2
0
4
5
5
6
4
5
6
4
7
8
8
7
8
8
7
8
8
Sorting the integers according to units, tens, and hundred place digits
6|Page
Description of Radix sort
Array:
1
2
4
3
1
5
8
Count:
0
0
Output:
1
2
2
3
0
1
3
4
1
1
4
5
2
2
5
6
3
3
6
6
4
4
7
6
5
5
7
6
8
Sorting at Unit, Tens and Hundred
Sort Elements at unit Place
121
001
432
23
564
045
788
121
023
432
045
564
788
045
121
432
564
788
Sort Elements at tens Place
001
Sort Elements at hundred Place
001
7|Page
023
8
LO2
Model for Programming languages
2.1 Language Paradigm
Language paradigms are approaches to deal with error using any source code language. The
difficulty of paradigm depends on programming language or we might also say that they are
strategies for resolving issues utilizing readily available tools and methods.
This phrase was coined by science historian Thomas Kuhn and used to refer to a group of theories,
norms, and techniques that collectively reflect a way of organizing knowledge, or more
specifically, a way of understanding the world, in his seminal book The Structure of Scientific
Revolutions. In his 1979 ACM Turing Award talk, "The Paradigms of Programming," Robert
Floyd used the phrase. A programming paradigm is a manner of conceiving computing and
arranging and organizing how computer activities should completed.
.
Programming Paradigm Types
2.1.1 Programming Methodology of Imperatives
The reduction of program development and maintenance costs is the primary goal of the imperative
programming paradigm. It is a manner or approach to programming.
2.1.2 Declarative-Based Programming
8|Page
The declarative paradigm focuses on the Program logic of the program and the outcome. The
program’s flow of control is not the key component according to this paradigm. The goal is the
major thing that is being concentrated on.
2.2 Procedural Model
The procedural paradigm is focused in terms of under lying machine model. It has the ability of
reuse. The main idea behind the procedure call serves as its foundation. Sequences, subsequences,
approaches, or functions are other names for procedures. A procedure is a collection of steps that
must be followed in order.
Example of Procedural programming Paradigm:
2.3 Object-Oriented Concepts
An object-oriented paradigm where we concentrate on actual physical objects. Representing the in
code is what object-oriented software aims to do. The smallest and basic entity is object and all
operation are based on the objects only. All types of real life problems scenarios are easily handled
by OOP.
The problem is broken down into smaller components known as objects in the object-oriented
paradigm, and systems are constructed around objects. The representations of things from the
actual world that we want to model in a computer system are handled by object instance.
The following are some behaviors of object-oriented programming:
9|Page
Data
Security
inheritance
Code
reusability
Abstraction
2.3.1 Data Security
Data is taken and safely protected from external interfaces through data security these user-defined
data types are referred to as "classes," and an "object" is an instance of a class.
2.3.2 Inheritance
The technique by which a class can be formed that has all the properties of the base class as well
as some of its own. Classes are established in hierarchies, and inheritance enables the assembly
and methods in one class to be distributed down the hierarchy, increasing code reuse. As a result,
less programming is required to add functions to complicated systems.
2.3.3 Code Reusability
The ability to abstractly and reuse the data variables and functions by declaring of different object.
This ability to exist in many ways enables the formation of processes for objects whose precise
type is unknown until runtime.
2.3.4 Abstraction
By excluding the superfluous aspects of the object, abstraction makes it easier to conceptualize
real-world objects.
2.3.5 Models for Event-Driven Programming
When software is created to react to user participation in multiple ways, it is said to be eventdriven. It is referred to as a programming paradigm in which "Events" control how programs are
implemented. Events are any user interactions that happen in response to a system prompt, like a
key press or mouse click.
10 | P a g e
An "Event listener" is a piece of code (a function) that monitors events. An event handler, often
known as a call-back function, will be triggered if the event listener notices that an allocated event
has occurred. An illustration is shown below.
Time
Driven
Event
Handler
Event
Driven
Events
Event
loop
The Characteristics of Event-driven Programming are as follows,
•
Time driven
Time-driven programming is a paradigm that refers to code that executes in response to a time prompt.
This code may run every week at a certain time or each time a programme is launched, making it a preset task.
•
Event Coordinators
An implementation of a function in response to a particular event is referred to as a "event handler."
A button serves as a good illustration of this; when it is clicked, code is executed; the code is
repeated when the button is clicked again; this is an example of an event handler.

Events (Mouse, Keyboard and user interface)
For each event that is likely to occur, most applications contain a trigger function that determines
what code is run when the event takes place. They are also used to decide when event handlers for
the actual event that happened are actually performed.
11 | P a g e
LO3
3.1 Implementation of Digital clock in different IDE
3.1.1 Code in C++ IDE:
12 | P a g e
Output C++:
13 | P a g e
3.1.2 Code in C# IDE:
Output C#
14 | P a g e
3.1.3 Code in Pycharm IDE:
Output in Pycharm:
15 | P a g e
LO4
4.1 An Integrated development environment
A software programme called an integrated development environment (IDE) is used to create apps.
Because of its graphical user interface, the programmer is shielded from a sluggish development
environment. It may include several pieces of software, including a text editor, a linker, a loader,
a debugger, and a compiler.
4.1.1 Editor for Source Code
Writing software code can be aided by a text editor that has capabilities like syntax highlighting
with visual cues, language-specific auto-completion, and bug checking as code is being written.
4.1.2 Debugger
Debugging tools assist users in identifying and fixing source code issues. They commonly mimic
real-world situations to evaluate functionality and performance. Programmers and software
engineers can frequently test the different code components and uncover any bugs before the
product is released.
4.1.3 Compiler
Programming languages are converted by compilers into binary code or another format that
computers can understand. Analysis is used to confirm the machine code's accuracy. The compiler
then parses the code and optimizes it to increase performance.
4.1.4 Local Build Automation
Tools that make it easier to compile computer source code into binary code, package binary code,
and conduct automated tests as part of constructing a local version of the software for the developer
to use.
4.1.4 Debugger
Tools that make it easier to compile computer source code into binary code, package binary code,
and conduct automated tests as part of constructing a local version of the software for the developer
to use.
4.2 Support for Programming Language
A single programming language is the focus of the majority of integrated development
environments (IDEs), however some also support additional languages. As a result, the first step
is to decide which programming languages will be utilized, after which you may concentrate on
the list of suitable IDEs.
16 | P a g e
4.3 Plugins and Integrations
Given the term "integrated development environment," it should come as no surprise that
interconnections must be taken into account while evaluating IDEs. Since the IDE acts as the
developer portal, the ability to combine all the extra development tools will improve development
workflows and efficiency. Consider how well a potential IDE integrates into the ecosystem of
other tools because poor integrations may cause a range of issues and make your life tough.
17 | P a g e
References
Paul Deitel and Harvey Deitel -; Java™ SE-8 for Programmers: Third Edition Prentice Hall, 2014
Booch, G. (1994) Object-Oriented Analysis and Design, Addison-Wesley. Macharia, N., 2018.
Noteworthy.
http://neonbrand.com/procedural-programming-vs-object-oriented-programmingareview/
(Lynch, A., 2020)
Cay S. Horstmann and Gary Cornell Core Java, Volume I – Fundamentals (11th Edition)
Prentice-Hall, 2015.
T. Mahea, 2014. Linkedin The importance of marketing in businesses by Timothy Mahea is
[online] accessible at: https://www.linkedin.com/pulse/20140915080650-84228363 [Accessed
2018].
P. Mckinney, n.d. study. [Online] [Accessed 2018] [What Are Marketing Objectives Examples
Lesson Quiz] [Study.com Academy Lesson] [Online].
A dichromatic framework for balanced trees by L. J. Guibas and R. Sedgewick. In
Proceedings
of
FOCS
1978,
pp.
8-21.
Red-black BSTs.
18 | P a g e
Download