Tải bản đầy đủ (.docx) (28 trang)

Assignment 2 Programming C#.Docx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (848.33 KB, 28 trang )

ASSIGNMENT 2 FRONT SHEET
Qualification

BTEC Level 5 HND Diploma in Computing

Unit number and title

Unit 1: Programming

Submission date

Date Received 1st submission

Re-submission Date

Date Received 2nd submission

Student Name

Student ID

Class

Assessor name

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
Grading grid
P2



P3

P4

P5

M2

M3

M4

D2

D3

D4


❒ Summative Feedback:

Grade:
Lecturer Signature:

❒ Resubmission Feedback:

Assessor Signature:

Date:



Contents
1

2

3

Chapter 1 – Introduction to your program. (P1)...................................................................................................5
1.1

Introduce the Overview...............................................................................................................................5

1.2

List the function of the Delta calculation program.......................................................................................5

Chapter 2 – Explain programming paradigms. (P1)..............................................................................................5
2.1

Explain what is Procedural Programming with source code and illustrations..............................................5

2.2

Explain what is Object-Oriented Programming with source code and illustrations......................................6

2.3

Explain what is Event-Driven Programming with source code and illustrations...........................................7


2.4

Conclude which paradigms will be used to develop the application with an explanation............................9

Chapter 3 – IDE features. (P1)............................................................................................................................10
3.1

Introduce what an IDE is............................................................................................................................10

3.2

Introduce features of IDE with illustrations................................................................................................10

3.2.1

The ability to detect errors:................................................................................................................10

3.2.2

Highlight the syntax contained in the code........................................................................................11

3.3
An explanation and evaluation of the debugging process in the IDE used and how it helped with
development..........................................................................................................................................................12
3.4

Evidence that you have used debugging during the implementation.........................................................12

3.5

An evaluation of developing applications using an IDE versus developing an application without using
an IDE. 12
4

Chapter 4 – Design and Implementation. (P1)...................................................................................................13
4.1

Flowchart of the application......................................................................................................................13

4.2

Source code and screenshots of the final application with explanation....................................................19

4.2.1

Source Code.......................................................................................................................................19

4.2.2

Screenshots of the final application....................................................................................................21

4.3

Explain and evaluate coding standards used in the program.....................................................................23

4.3.1

Space between methods:...................................................................................................................23

4.3.2


Rule of brackets:................................................................................................................................24

4.3.3

if .. else...............................................................................................................................................26

4.3.4

Length of a line of code......................................................................................................................27


4.4
4.4.1

Explain the benefits of using coding standards..........................................................................................27
Benefits of using coding standards.....................................................................................................27

REFERENCES...............................................................................................................................................................28


1
1.1

Chapter 1 – Introduction to your program. (P1)
Introduce the Overview:
● Nowadays, there are many schools in the country. Especially with large schools, there are
many students attending. Therefore, it is not easy to manage student data. Seeing this
difficulty, I wrote a program to manage student data.


1.2

List the function of the Delta calculation program:







2
2.1

Add new student
Delete a student
Search a student by id
Sort students by average
Show all student
Exit

Chapter 2 – Explain programming paradigms. (P1)
Explain what is Procedural Programming with source code and illustrations.
● Procedure-oriented programming, often known as procedural programming, is a
classic programming method that divides a program into functions.
● Subroutines execute with the aid of other functions or smaller subroutines. In other
words, structured programming reduces a large problem to a smaller one and a smaller
one to a smaller one. Once the issue is resolved, keep going. Simply put, structured
programming breaks down a big problem into a small problem, a minor problem into a
micro problem. And so on until the problem is solved.
● Characteristic:

o While designing a program, POP follows a top-down programming approach.
o Most functions allow system-wide data to be shared.
o It also divides more extensive programs into smaller parts called functions.
o It allows data to move freely around the system.
o Functions convert data from one form to another.


Figure 1: POP in the program.
(Source: />
2.2

Explain what is Object-Oriented Programming with source code and illustrations.
● OOP is considered to increase productivity, simplify maintenance complexity, and extend
software by allowing programmers to focus on higher-order software objects. In addition,
many people think that OOP is more receptive to those who are new to programming
than previous methods. In a nutshell, this is a concept and an attempt to lighten the code
for programmers, allowing them to create applications where external elements can
interact with those programs. like interacting with physical objects.
● Objects in an OOP language are combinations of code and data that are seen as a single
unit. Each object has a unique name, and all references to that object are made through
its name. Thus, each object has the ability to receive messages, process data (inside it),
and send out or respond to other objects or to the environment.

● Characteristic:
o Inheritance: Inheritance allows building a new class (Child class), inheriting and
reusing properties and methods based on the old class (Parent class) that existed
before. The Child classes inherit all the Parent class members and do not need to
be redefined. Subclasses can extend inherited components or add new ones.
o Polymorphism: Diversity in OOP settings allows different objects to perform
the same function differently.

o Encapsulation: Encapsulation allows hiding information and the internal
processing properties of the object. Other objects cannot directly affect the data
inside and change the object's state but must go through public methods provided
by that


object. This property helps to increase the object's security and avoid unintentional
data corruption.
o Abstraction: Calculation help remove the unnecessary complexity of the object
and focuses only on what is essential.

Figure 2: OOPs in program.
(Source: />2.3

Explain what is Event-Driven Programming with source code and illustrations.
● In computer programming, event-driven programming is a programming paradigm in
which the flow of a program is determined by events such as user actions (clicks, key
presses, etc.), sensor output, or messages from programs or streams. Event-driven
programming is the dominant paradigm used in graphical user interfaces and other
applications (e.g. JavaScript web applications) that focus on performing certain actions in
response to input.


user input. The same is true for programming for device drivers (e.g. P in the USB device
driver stack).[1]
● In an event-driven application, there is usually a main loop that listens for events and then
fires a callback function when one of those events is detected. In embedded systems, the
same can be achieved by using hardware interrupts instead of a continuously running
main loop. Event-driven programs can be written in any programming language, although
the task is easier in languages that provide a high level of abstraction, such as to await and

closure.

● Characteristic:

o

o
o
o

Service-Oriented: Service-oriented is a significant aspect of event-driven
programming used to develop programs for services. It does not slow down
the computer since service-oriented only uses a tiny percentage of the
computer processing power, and services typically operate in the operating
system's background.
Even: Nothing will happen unless the user interacts with the software, according
to this feature. Clicking buttons and entering text into text fields are examples of
events.
Trigger Functions: According to this feature, nothing will happen until the user
interacts with the software. Events include things like clicking buttons and
putting text into text areas.
Event handlers: When an event happens, an event handler is a function or method
that performs a particular action. An event handler may, for example, be a button
that, when clicked, shows a message and then shuts it when the user hits the
button again.


Figure 3: Event Driven Programming.
(Source: />2.4


Conclude which paradigms will be used to develop the application with an explanation.
● I have used OOP and a mixture of POP to build a student data management program. I use
OOP and POP and I use both because it will be easier to manage students when the
program will help find student data in the system without having to find each student's
records as before.
● Easy project expansion.
● Help programmers can save considerable time.


3

Chapter 3 – IDE features. (P1)

3.1

Introduce what an IDE is
● To put it simply, an IDE is a combination of functions that help you program, debug,
and compile. IDEs are developed to make it easier for programmers to develop
software.
● IDE stands for Integrated Development Environment - integrated
development environment.
● Before IDEs were developed, the only way for programmers to program was to
use Texteditor software, such as Notepad.
o Source code editor: A text editor that can assist in writing software code with
features such as syntax highlighting with visual cues, providing languagespecific auto-completion, and checking for bugs as code is being written.
o Local build automation: Utilities that automate simple, repeatable tasks as part
of creating a local build of the software for use by the developer, like compiling
computer source code into binary code, packaging binary code, and running
automated tests.


o

3.2
3.2.1

Debugger: A program for testing other programs that can graphically display
the location of a bug in the original code.

Introduce features of IDE with illustrations.
The ability to detect errors:

● Typing or missing a certain character in the coding process is inevitable, and not

everyone has the ability to check their own errors. Therefore, IDEs are also integrated
with this feature to help programmers detect errors more quickly


Figure 4: The ability to detect error
(Source: />
3.2.2

Highlight the syntax contained in the code:
● Programmers can readily discern syntaxes in code by using IDEs' ability to display them
in different colors, making it simple to link code together.


Figure 5: Highlight the syntax contained in the code
(Source: />3.3

An explanation and evaluation of the debugging process in the IDE used and how it helped

with development.
● When building a large program, a professional programmer will spend no less time
writing test code than they spend writing the program itself. Therefore, we will not be
able to avoid basic errors while programming. But when in a long test code that we only
make a small mistake in it, it will take a lot of time to check and fix that error. But I've
heard some people say that IDE's debugger is very good, it helps users to find errors and
help them fix them. In this article, I have not used the debugger because my program
writing is small and quite easy. I'll be using the debugger in a not too distant day.

3.4

Evidence that you have used debugging during the implementation.
● Unfortunately I didn't use the debugger when writing the program. Since my program
is pretty small and basic I haven't used the debugger. I will probably use it with the
next program I write. One day I might need it.

3.5

An evaluation of developing applications using an IDE versus developing an application
without using an IDE.
● IDE is an integral part of the software application development process. With the IDE and
the tools it brings, the programming process becomes more convenient, easier, and less
error-prone. In the absence of an IDE, you can write source code using the corresponding
compiler of the programming language. This work will require a lot of time, adding many
complicated steps, but not bringing the desired effect, especially in programs with
difficult


programming steps. Benefits of using IDE software with its advantages, IDE is really
indispensable in the process of writing software applications. They are sought after by

many programmers, although not necessary, but really necessary. IDE is known as divine
software for programmers in developing software applications.
4
4.1

Chapter 4 – Design and Implementation. (P1)
Flowchart of the application.
a) Add a student:


Figure 6: Flowchart about add a student.
b) Delete a student:


Figure 7: Flowchart Delete a student
c) Search a student by id:


Figure 8: Flowchart Search a student by id
d) Sort student by id:


Figure 9: Flowchart Sort a student by id
e) Show all student:


Figure 10: Flowchart Show all student


4.2

4.2.1

Source code and screenshots of the final application with explanation.
Source Code.


UNIVERSITY of

GREENWICH
Alliance with

gf 11.

Education



×