1. Trang chủ
  2. » Công Nghệ Thông Tin

Assignment 2 Programming C#.Docx

28 8 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Programming
Trường học Brunel University London
Chuyên ngành Computing
Thể loại assignment
Năm xuất bản 2023
Thành phố London
Định dạng
Số trang 28
Dung lượng 0,95 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

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[.]

Trang 1

ASSIGNMENT 2 FRONT SHEET

Student declaration

I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism I understand thatmaking a false declaration is a form of malpractice

Student’s signature Grading grid

Trang 2

Summative Feedback: ❒ Resubmission Feedback:

Lecturer Signature:

Trang 3

1 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

2 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

3 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

Trang 4

4.4 Explain the benefits of using coding standards 27 4.4.1 Benefits of using coding standards 27 REFERENCES 28

Trang 5

1 Chapter 1 – Introduction to your program (P1)

1.1 Introduce the Overview:

● Nowadays, there are many schools in the country Especially with large schools, there aremany students attending Therefore, it is not easy to manage student data Seeing thisdifficulty, I wrote a program to manage student data

1.2 List the function of the Delta calculation program:

● Add new student

● Delete a student

● Search a student by id

● Sort students by average

● Show all student

● Exit

2 Chapter 2 – Explain programming paradigms (P1)

2.1 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

Trang 6

Figure 1: POP in the program.

(Source: https://docs.microsoft.com/en-us/windows/win32/rpc/the-programming-model)

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

Trang 7

object This property helps to increase the object's security and avoid unintentionaldata 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: https://programmerbay.com/what-are-the-five-main-features-of-oops/)

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

Trang 8

user input The same is true for programming for device drivers (e.g P in the USB devicedriver stack).[1]

● In an event-driven application, there is usually a main loop that listens for events and thenfires 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 andclosure

● Characteristic:

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

o 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

o 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

o 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

Trang 9

Figure 3: Event Driven Programming.

(Source: https://www.thuatngumarketing.com/event-driven-programming/)

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

Trang 10

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 language-specific 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 Debugger: A program for testing other programs that can graphically display the location of a bug in the original code

3.2 Introduce features of IDE with illustrations.

3.2.1 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

Trang 11

Figure 4: The ability to detect error

(Source: https://helpex.vn/question/tu-dong-phat-hien-loi-trong-intellij-idea-60dd4c5f7a3582d36e88e247 )

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

Trang 12

Figure 5: Highlight the syntax contained in the code (Source: https://vi.wordpress.org/plugins/my-syntax-highlighter/)

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

Trang 13

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 divinesoftware for programmers in developing software applications.

4 Chapter 4 – Design and Implementation (P1)

4.1 Flowchart of the application.

a) Add a student:

Trang 14

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

Trang 15

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

Trang 16

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

Trang 17

Figure 9: Flowchart Sort a student by id

e) Show all student:

Trang 18

Figure 10: Flowchart Show all student

Trang 19

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

Trang 20

UNIVERSITY of

GREENWICH

All i anc e wi th g f11.Educat i on

Trang 21

Figure 11: Source code

● Explanation: This is a program written about input and output of student data

4.2.2 Screenshots of the final application.

● After the software has run, this is the menu screen

● The software will display six features

Trang 22

○ 1 Add new student

○ 2 Delete a student

○ 3 Search a student

○ 4 Sort student by average

○ 5 Show all student

○ 6 Exit

● The program will prompt the user to enter "How many pupils do you wish to add" when the user chooses function 1

● The user will next be prompted to input their name, age, and average score

● The user will then enter the following pupils

● When you choose function 4, the program will tell us the name, age and average score

of the student

Trang 23

● When you choose function 5, the program will tell us the name, age, and average score

of all students

● When you select function 6, our program will end

4.3 Explain and evaluate coding standards used in the program

4.3.1 Space between methods:

● Building a program can be frustrating if there is no clarity between methods when a programmer needs to add something to a method if there is a blank line between will create transparency, the programmer will be able to find a method needed a quick edit, I've also implemented it in my library manager and I find it very useful in building your program

Trang 24

Figure 12: Space between methous

4.3.2 Rule of brackets:

● There are two rules for closing brackets:

○ Put brackets on the same line as the keyword

○ Put brackets on the next line to align with closing brackets

○ In my program, I used solution two because I feel when I write multiple blocks

of commands, I align parentheses to easier code management

Trang 25

Figure 13: Rules of brackets

Trang 26

4.3.3 if else:

Figure 14: If else

Trang 27

4.3.4 Length of a line of code:

Figure 15: Length of a line of code

● In my program, each line of code contains only one statement, and each line should have no more than 75 characters for optimal display

4.4 Explain the benefits of using coding standards.

4.4.1 Benefits of using coding standards.

● Reduce project risk as much as possible: Coding standards lower the probability of

failures since software development issues frequently cause IT initiatives to fail

● Minimizes complexity: A code is more susceptible to errors the more sophisticated it is

Coding standards help create software systems that are less complex, which lowers errors

● The elimination of bugs: Finding and resolving software bugs is made straightforward by

consistent source code

● a thorough perspective: Understanding how the code fits into the larger program or

the company as a whole is made possible by consistent source code

Trang 28

https://stackoverflow.com/?fbclid=IwAR0nX84qRVujvA-3 app.diagrams.net, Available at : https://app.diagrams.net/ (Accessed 24th June 2022)

4 en.wikipedia.org, Available at :

https://en.wikipedia.org/wiki/Event-driven_programming (Accessed 24th June 2022)

Ngày đăng: 28/02/2023, 22:01

w