Docsity

Unit 1: Programming assignment1, Schemes and Mind Maps for Computer science, Assignments of Programming Languages

Toggle sidebar
bg1
Qualification Unit Number and Title
Pearson BTEC HND in Computing Unit 1: Programming
Student Name Assessor Name
Muhammad Abdullah Abbasi Miss Qurat-ul-Ain
Hand in date Competition Date Submission Date
Assignment Title Design and implementation of classes, event programming, and
object-oriented code with a particular IDE.
Submit Policy This task must be finished on time. You must let your tutor know if
you run into any problems.
Early Finish Policy Students with good reasons for submitting late will be taken into
consideration (e.g. illness).
Plagiarism
Guidelines
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: Date:
Content
1 | P a g e
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Unit 1: Programming assignment1, Schemes and Mind Maps for Computer science and more Assignments Programming Languages in PDF only on Docsity!

Qualification Unit Number and Title

Pearson BTEC HND in Computing Unit 1: Programming

Student Name Assessor Name

Muhammad Abdullah Abbasi Miss Qurat-ul-Ain

Hand in date Competition Date Submission Date

Assignment Title Design and implementation of classes, event programming, and

object-oriented code with a particular IDE.

Submit Policy This task must be finished on time. You must let your tutor know if

you run into any problems.

Early Finish Policy Students with good reasons for submitting late will be taken into

consideration (e.g. illness).

Plagiarism

Guidelines

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: Date: Content

s

Object Oriented Programming:

The object-oriented programming language plays an important role in the Human interface. It provides the different components that take the real-world objects and perform the action on them that produce the live interactions between humans and machines. Some features of OOP are  Being faster and easier to execute  Make it easier to reuse the code  Giving a programme a clear structure  Making the code simpler to edit, debug, and maintain

Event Driven Programming.

In 2020, 80% of all business-related digital applications will be required to employ a real-time, event-based strategy, according to Gartner. "Events" are activities that can be user-generated in event-driven programming, such as button clicks, mouse events, and graphic movement choices. On the basis of the event handling procedure, events also relate to the decision-making process.  You’ve just pressed a key (text editor)  A loan application has either been accepted or denied (commercial business)  Approval of Wall Mart account (account verification)  A pattern of unlawful trade has been discovered (fraud detection)  In a video game, an automobile strikes another vehicle (racing game)  A robot has arrived at its location (real-time warehouse management) Event programming is an approach used in the early stages of product development, not a technology or programming language. In essence, it disentangles an application's event- processing logic from the rest of the code.

Classes and Inheritance:

“Class is the predefined definition of the method and variable which can be accessed by object and object is the instance of a class that contains real values and inputs.” Multiple classes are used to manipulate the problem but it can handle by inheritance. Inheritance is the part of classes that can relate classes with each other and reduce the complexity level

Task 01

1.1 Algorithm

An algorithm is just a series of steps used to carry out a certain activity. It serves as a foundation for programming. A programming language was used to create the pseudocode, structural diagram, and flowchart that make up the algorithm. An algorithm has the qualities of clarity, fineness, effectiveness, and language independence. 1.1.1 Algorithm Features:

  • Input: An algorithm needs a certain set of input variables. An algorithm may receive an input value other than 0.
  • Output: At the end of an algorithm, one or more results will be produced.
  • Unambiguity: A perfect algorithm must be unambiguous, which implies that its directives must be plain and simple.
  • Finiteness: We need a finite algorithm. An algorithm must have a finite number of instructions, or instructions that can be counted, in order to be considered "finite" in this context.
  • Effectiveness: An algorithm must be effective because every instruction has an impact on the whole procedure.
  • Language independence: A language-independent algorithm is one whose instructions work the same way regardless of the language in which they are expressed. 1.1.2 Algorithm TypesSorting algorithms: Bubble Sort, insertion sort, and many more. The data is sorted using these techniques in a certain format.  Searching algorithms include binary search and linear search. These methods are used to locate the value or record the user is looking for.  Graph Algorithms : are used to find solutions to issues like determining the shortest route between cities and practical issues like the difficulty associated with traveling salesmen. 1.2 Heap Sort: Binary heap data structures and a sorting algorithm are the foundation of the comparison known as heap sort. In that the minimal element is found and put at the beginning, it functions similarly to a selection sort. The similar technique is used to sort other parts.

Method to sort above array from Heap sort Total Nodes= 11 Last non-leaf node index=(11/2)-1= Last non-leaf node = To heapify use nodes are “1, 3, 5, 4, 6” in reverse order Heapify 6: Swap 6 and 17 Heapify 4: Swap 4 and 9 Heapify 5: Swap 13 and 5 1 3 4 9 8 17 15 6 5 13 10 1 3 9 4 8 17 15 6 5 13 10

Heapify 3: Swap 3 and 17, again Swap 3 and 15 Heapify 1: Swap 1 and 17, again swap 1 and 15, Last swap 1 and 6 1 3 9 4 8 17 15 6 13 5 10 1 17 9 4 8 15 3 6 13 5 10 17 15 9 4 8 6 3 1 13 5 10

Imperative programming is essentially the polar opposite of declarative programming. In order to decide how to compute, the user typically directly modifies the state of the computer in imperative programming. Here is an illustration of the paradigm that made this programming approach popular:  Procedural Programming  Object Oriented programming  Parallel Processing. 2.1.2 Declarative Programming Declarative programming specifies the properties of the desired outcome without describing how it was calculated, as opposed to precisely specifying what the computer should be doing at any particular moment. Examples of paradigms include  Logical Programming  Functional Programming  Database Processing 2.2 Procedural Model Programing A sequence of computing steps is divided into modules according to the procedural programming paradigm. This implies that the code is organized into functions and is run sequentially, one step at a time. To basically instruct the computer to perform a specific action at each step, it combines serial code. This paradigm lends itself to the modularization of code, which is often accomplished. Pros of Procedural Programming:  General Programming  Code Reusability  Portable source code Cons of Procedural Programming:  Privacy  Unsuitable for real thing

 Hard to write 2.3 Object-Oriented Concepts. When programming the solution, we use an object-oriented paradigm that focuses on the actual physical objects. Representing the outside world in code is the goal of object-oriented software. Problems are broken down into smaller components called objects in the object-oriented paradigm, and systems are built around objects. The representations of real-world things that we model in computer systems are called objects. The following are some traits of object-oriented programming: 2.3.1 Encapsulation Data is inherited from the external interface by encapsulation and safety protected. These user- defined data types are called “CLASSES” and “OBJECT” are instances of classes. 2.3.2 Abstraction Ability to present data abstractly and completely without details. By eliminating the superfluous aspects of objects, abstraction facilitates the notion of real objects. 2.3.3 Inheritance Encapsulation Inheritance Polymorphism Abstraction OOPS Concept

weather forecasts, sports scores, and other information. The Characteristics of Event-driven Programming are as follows,

  • Time driven Code is performed at a time prompt using the notion of time specification in event-driven programming. This is some code that executes at a certain time (once a week or when the programme starts). It is a predefined task as a result.
  • Event handlers Code is performed at a time prompt using the notion of time specification in event-driven programming. This is some code that executes at a certain time (once a week or when the programme starts). It is a predefined task as a result.
  • Trigger functions Trigger functions are used to choose which pieces of code should run in response to a specific event, as well as when to execute event handlers for the fired event. For each likely occurrence, most apps offer a trigger function.
  • Event Loop

Event

Trigger

Event

Handler

Event

loop

A feature of programming that continuously checks for external events and invokes the proper procedures to handle them. The event loop, which is frequently the program's primary loop, typically waits for a user action to initiate something. The first software engine in this encyclopedia's main loop is shown in the example below. The main loop, which is built in Turbo C, continuously evaluates inputs, mouse events, and menu choices.

Task 03

3.1 Implementation of Tic Tac Toe Game in different IDE 3.1.1 Code in Python IDE:

Output C++

3.1.2 Code in C# IDE: