assignment 2 front sheet qualification btec level 5 hnd diploma in computing

120 0 0
Tài liệu đã được kiểm tra trùng lặp
assignment 2 front sheet qualification btec level 5 hnd diploma in computing

Đ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

As a result, I''''ll create a WinForm application utilizing Microsoft Visual Studio''''s C# programming language.. The local variable can only be used in the method in which it is defined; if

Trang 1

ASSIGNMENT 2 FRONT SHEETQualificationBTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

submission

Trang 3

❒Summative Feedback: Resubmission Feedback:

Lecturer Signature:

Trang 5

Table of Contents

I Introduction to the program 6

1 Scenario and Requirement Analysis 6

2 Common features of IDE 35

2.1 User Start Window 36

2.2 Windows Form Design 37

Trang 6

4.2 Not using an IDE (text editor) 51

Trang 7

IV Coding standards 52

1 Definition 52

2 Coding standards in my code 52

3 Coding standard is necessary in a team as well as for the individual 57

References 60

Table Of FiguresFigure 1 List 7

Figure 2 Class Book 9

Figure 3 Class Book 10

Figure 4 Class Borrow 11

Figure 5 Flowchart Login 12

Figure 6 Flowchart Add 13

Figure 7 Flowchart Edit 14

Figure 8 Flowchart Delete 15

Figure 9 Flowchart of Borrow Book 16

Figure 10 Flowchart Return Book 17

Figure 11 Main Winform 18

Figure 12 Search in Book List 19

Figure 13 Login 20

Figure 14 Functions 21

Figure 15 Adding or Editing error message 22

Figure 16 Warning of deleting 22

Figure 17 Warning of deleting 23

Trang 8

Figure 18 Wrong Day Need To Return 24

Trang 9

Figure 19 Borrow List 25

Figure 20 Unavailable to Borrow 26

Figure 21 Search in List of book borrowers 27

Figure 22 Fee 28

Figure 23 Visual studio interface (Article, 2021) 35

Figure 24 Start Window of Microsoft Visual Studio 36

Figure 25 Windows Forms 37

Figure 26 Toolbox 38

Figure 27 Proposal completed 39

Figure 28 Constructor automatically 39

Figure 29 Constructor automatically 40

Figure 30 Start with and without Debugging 40

Figure 31 Logical error 41

Figure 32 Breakpoint 42

Figure 33 Step Over 43

Figure 34 Result of Step Over in Visual Studio tip 44

Figure 35 Run To Cursor 45

Figure 36 Run To Cursor 45

Figure 37 Run To Click 46

Figure 38 Locals 46

Figure 39 The Watch 47

Figure 40 Using visual studio to code 49

Figure 41 Curly Brackets 53

Figure 42 Inter-term 53

Figure 43 Comments 54

Figure 44 Make lines at the samee level 55

Figure 45 Var 55

Figure 46 Blank line 56

Figure 47 Keyword in C (Dotnet Concepts, 2011) 57

Trang 11

I.Introduction to the program.

I was given a challenge to design a library application that was produced using the IDE and was subject to Coding standards for a comprehensive business problem after passing the presentation to exhibit my problem solving and fundamental programming abilities As a result, I'll create a WinForm application utilizing Microsoft Visual Studio's C# programming language The software will include the following features: Add, Edit, Delete, and Search In addition, I'veincluded several additional functions to improve the program's functionality And now for my report.

1 Scenario and Requirement Analysis.

Trang 13

2 Design Phase.2.1 Data structure:

In this article, I use List as a list of objects It can be accessed by index It is located in the System.Collections.Genericnamespace Where this list can be used to create a set of different variables like: Integer, string, And I use List with 2 objects It is used for the list of books in the library (aList) and the list of students borrowing books (bList).

Trang 14

String availability

Trang 15

String status

Trang 19

- Borrow: This feature includes a list that stores the loan list's text; each individual added will have the same data type andproperties.

Trang 20

String people

Trang 21

String booknameString datebString dater

Trang 23

Functions:Login:

Trang 25

Add Book:

Trang 27

Edit Book:

Trang 29

Delete Book:

Trang 31

Borrow Book:

Trang 33

Return Book:

Trang 57

Key Features of Procedural Programming: (Sagar Bhatia, 2021).

+ Predefined functions: A preset function is usually an instruction with a name attached to it Predefined functions are

usually included in higher-level programming languages, however they are drawn from a library or registry rather thana program 'charAt()' is an example of a pre-defined function that looks for a character location in a string.

+ Local Variable: A local variable is a variable that is defined in the method's main structure and is only valid inside the

scope of the method The local variable can only be used in the method in which it is defined; if it is used outside of thatfunction, the code will fail.

+ Global Variable: A global variable is one that is declared outside of every other function in the program As a result,

unlike local variables, global variables can be utilized in any function.

+ Modularity: When two distinct systems are given two separate tasks to complete, they are grouped together to

complete a bigger job first The tasks of each set of systems would subsequently be completed one by one until all tasks were completed.

+ Parameter Passing: A system for passing parameters to functions, subroutines, and procedures is known as

parameter passing 'Pass by value', 'pass by reference', 'pass by result', 'pass by value-result', and 'pass by the name' areall methods for passing parameters.

Therefore, in my program, there are 7 main procedural paradigms used, which are:+ Adding new book.

+ Editing existing books in DataGridView of library.

Trang 58

+ Deleting a book in DataGridView of library.

Trang 59

+ Search book in DataGridView of library (Following Name, Author or Category).+ Borrow book in DataGridView of library.

+ Return book in DataGridView of book borrowers.

+ Search book in DataGridView of book borrowers (Following Name or Book).

2 OOP paradigm.

Object-oriented programming (OOP) is a programming paradigm that organizes software design around data, ratherthan functions and logic An object is a data field with its own set of properties and behavior (Alexander S Gillis, 2021).

Structure: (Alexander S Gillis, 2021).

+ Classes: are data types that are created by the user and serve as the blueprint for individual objects, properties, and

+ Objects: are instances of a class that have been constructed with specified data Real-world items or abstract entities

can be represented by objects The description is the sole object defined when a class is created for the first time.

+ Methods: are functions that describe an object's behavior and are specified within a class In class declarations, each

method begins with a reference to an instance object In addition, instance methods refer to the subroutines that make up an object Methods are used by programmers to ensure reusability and to keep functionality contained to a single object at

Trang 60

a time.

Trang 61

+ Attributes: describe the status of an object and are defined in the class template Data will be saved in the attributes

field of objects The class's characteristics are the class's own.Object programming characteristics: (Alexander S Gillis, 2021).

+ Encapsulation: This concept asserts that an object contains all relevant information and only selective information is

revealed Each object's implementation and state are kept private within a specified class This class is not accessible to other objects, and they do not have the ability to modify it Only a list of public functions or methods are available to them.This data masking feature improves application security and avoids data corruption that isn't intended.

+ Polymorphism: Objects merely show the internal mechanisms that let them to interact with other objects, concealing

any extraneous implementation code The functionality of the derived class can be expanded Developers may find it easier to make adjustments or additions over time if they use this notion.

+ Abstraction: Code from other classes can be reused by classes Developers may establish relationships and

subclasses between items, allowing them to reuse similar logic while preserving a distinct hierarchy OOP's virtue of forcing more extensive data analysis reduces development time and ensures greater correctness.

+ Inheritance: Objects are created to communicate behaviors and come in a variety of shapes and sizes The program

determines what meaning or usage is required for each execution of a superclass object, avoiding the requirement for duplication of code Then a subclass is developed that extends the parent class's functionality Different sorts of objectscan flow via the same interface thanks to polymorphism.

Popular pure OOP languages include:+ Ruby

Trang 62

+ Scala

Trang 63

+ JADE+ Emerald

Programming languages designed primarily for OOP include:+ Java

+ Python+ C++

Other programming languages that pair with OOP include:+ Visual Basic NET

+ PHP+ JavaScript

3 Event-Driven paradigm

Event-driven programming is a programming paradigm in which the control flow of a program is determined by the occurrence of events This sort of software is made to detect events as they happen and respond with an appropriateevent-handling technique, which is usually a callback function or method (ukessays, 2021).

Trang 64

Key features and characteristics of event-driven programming: (ukessays, 2021).

Trang 65

+ Service Oriented: Service oriented programming is a crucial component of event-driven programming that is used to

develop programs for services It does not slow down the computer since service oriented programming uses very little

processing power and normally runs in the background of the operating system.

+ Time Driven: Time driven programming is a paradigm in event driven programming; it's code that runs on a time trigger

Time driven programming can be a specific code that runs on a specified time, such as once an hour, once a week, or once a month; it's a pre-set to do activity Windows Update, for example, is a time-driven system in which the user may specify when to update or when to look for and download updates.

+ Event Handlers: When a certain event is triggered, event handlers are a sort of function or method that performs a

specified action For example, an event handler may be a button that displays a message when the user clicks it andcloses the message when the user clicks the button again.

+ Trigger Functions: In event-driven programming, trigger functions are functions that determine what code to execute

when a given event happens They are also used to determine which event handler to use when a specific event occurs.

+ Events: Mouse, keyboard, and user interface events must be triggered in the program for them to occur, which means

the user must interact with an item in the program, such as clicking a button with a mouse, selecting a button with the keyboard, and so on.

Here are some examples of possible events:+ Click the button on the screen.

+ Press the key on the keyboard.

Trang 66

+ Hover.

Trang 67

+ Timeout.

+ Receive the output signal of the sensor.

+ Receive messages from other programs or threads.

1 Definition.

Integrated development environments (IDEs) are programs that make it easier to create other programs One of the key advantages of an IDE, which is designed to integrate all programming jobs in one application, is that it provides a central interface with all the tools a developer requires, including: (Veracode, 2019).

+ Code editor: These editors differ from text editors in that they seek to either simplify or enhance the process of creating

and modifying code for developers.

+ Compiler: Compilers convert source code written in a human-readable/writable language into a computer-executable

+ Debugger: During testing, debuggers are used to assist developers in debugging their application applications.

+ Build automation tools: These may be used to automate typical development processes in order to save time.

This is how the Source Editor and Debugger look like in Microsoft Visual Studio 2021

Trang 69

2 Common features of IDE.

I use Visual Studio 2021 with C# Winform for this design, so I'll go over some of its main features.

Trang 70

g , g

Trang 71

2.1 User Start Window.

When we open Visual Studio, we will see the window screen of Microsoft Visual Studio Here, we can easily choosedifferent functions such as: Open a project or folder or can create a new project Besides, we can also easily trackback old projects in Open Recent.

Trang 73

2.2 Windows Form Design.

We will select Create a new project, then find Windows Forms App (.Net Framework) for C# Then fill in the information and we will have a Windows forms as shown below.

Trang 75

In it, Visual Studio has supported us with the toolbox It has all the necessary features for us to use for example:Button, Check Box, Label, etc Thanks to that, form design will be easier and more efficient for programmers.

Trang 77

With the proposal completed, it saves your time a lot It will suggest you the passages that you use the most And in some cases when you forget the name of the properties or method of an object, it can help you easily.

Figure 27 Proposal completed

2.2.3.Generate getter/setter, constructor automatically.

To shorten the time, when creating a class for an object, we need to build a getter/setter for each part of it With theshortcut "propfull" we can quickly create a function, then we just need to press "Tap".

Trang 79

2.2.4.Integrate compiler.

After we have finished the code, we will run the program Visoul Studio gives us 2 options: with and without debugging.

Figure 30 Start with and without Debugging

3 Debugging process.3.1 Definition:

Debugging is the process of using debugging tools to assist developers find and fix flaws, problems, and anomalies in computer programs that impact how they function and what they produce Debugging allows the software to function properly and effectively by checking, detecting, and correcting flaws or defects (ee, n.d.)

Trang 81

Almost all IDEs, such as Eclipse, Visual Studio, Android Studio, Net Beans, and others, have debugging facilities The stages to debugging are usually determined by the sort of fault you're seeking to solve I'll go through two different sorts ofdebugging procedures.

They're comparable in certain ways:- Run-time error.

- Logical error.

3.1.1.Run-time error.

If you're stuck with DevideByZeroException, for example, you may set a breakpoint in this method and run it in debug mode to observe it execute step by step and investigate how your code acquires a variable with a value of zero Run-timeError is the name for this sort of error DevideByZeroExceptions are discovered during the execution of the program.

3.1.2.Logical error.

Logical errors are difficult to detect since they are not always obvious A logical mistake is a flaw in a software that causes it to run regularly but not abnormally (or crash like Run-time error) This mistake causes an unexpected error orother behavior, which you may not notice right away You build a C# function to calculate the sum of two integers, for example.

Ngày đăng: 09/05/2024, 14:14

Tài liệu cùng người dùng

Tài liệu liên quan