Docsity assignment 2 l programming 1618 PDF

Title Docsity assignment 2 l programming 1618
Author Anh Nguyen Van
Course Programming Foundations
Institution University of Greenwich
Pages 51
File Size 3.3 MB
File Type PDF
Total Downloads 381
Total Views 584

Summary

Download Docsity assignment 2 l programming 1618 PDF


Description

Assignment 2 l Programming 1618 Programming Languages FPT University 50 pag.

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

Qualification

BTEC Level 5 HND Diploma in Computing

Unit number and title

Unit 1: Programming

Submission date

31/8/2021

Date Received 1st submission

Re-submission Date

Date Received 2nd submission

Student Name

Tran Doan Dung

Student ID

GCH200619

Class

GCH0908

Assessor name

Lai Manh Dung

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

Dzung

Grading grid P2

P3

P4

P5

M2

M3

M4

D2

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

D3

D4

 Summative Feedback:

Grade: Lecturer Signature:

 Resubmission Feedback:

Assessor Signature:

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

Date:

Table of Contents 1. Introduction ................................................................................................................................................ 6 2. Chapter 1: Introduction to your program.................................................................................................... 6 2.1 Overview of the problem ...................................................................................................................... 6 2.2 List out application’s requirements ...................................................................................................... 6 3.Chapter 2: Explain programming paradigms .............................................................................................. 8 3.1 Procedural Programming ...................................................................................................................... 8 3.2 Object-oriented programming ............................................................................................................ 11 3.3 Event-driven programming ................................................................................................................ 14 3.4 The relationship between procedural programming, object-oriented programming and event-driven programming. ........................................................................................................................................... 16 4. Chapter 3: IDE features ............................................................................................................................ 17 4.1 IDE definition ..................................................................................................................................... 17 4.2 Features of IDE with illustrations....................................................................................................... 19 4.3 Debug ................................................................................................................................................. 23 4.3.1 Definition..................................................................................................................................... 23 4.3.2 Debugging process in the IDE used and how it helped with development. ................................ 23 4.3.3 how the debugging process can be used to help develop more secure, robust applications ....... 29 4.4 An evaluation of developing applications using an IDE versus developing an application without using an IDE. ............................................................................................................................................ 29 5. Chapter 4: Design and Implementation .................................................................................................... 32 5.1 Flowchart, source code and screenshots of the final application ....................................................... 32 5.1.1 Function CheckInfo ..................................................................................................................... 32 5.1.2 Button Add .................................................................................................................................. 34 5.1.3 Cell Click Event .......................................................................................................................... 37 5.1.4 Button Edit................................................................................................................................... 38 .............................................................................................................................................................. 39 Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

5.1.5 Button Remove ............................................................................................................................ 41 5.1.6 Button Sort................................................................................................................................... 43 5.1.7 Button Exit................................................................................................................................... 45

5.2 Some coding standards used in the program ...................................................................................... 46 6. Inconclusion ............................................................................................................................................. 49 References .................................................................................................................................................... 49

Table of Figure Figure 1- Use Case ......................................................................................................................................... 7 Figure 2- Software interface ........................................................................................................................... 8 Figure 3- How Procedural programming runs the program ........................................................................... 9 Figure 4- For loop Example ......................................................................... Error! Bookmark not defined. Figure 5- Compare Loops............................................................................. Error! Bookmark not defined. Figure 6- Function in C# .............................................................................................................................. 10 Figure 7- Using Procedural Programming in the Program........................................................................... 11 Figure 8- Show charges for packages........................................................................................................... 11 Figure 9- How Object-oriented programming runs the program ................................................................. 12 Figure 10- Object-Oriented Programming ................................................................................................... 13 Figure 11- Display the values of Object in the Product class....................................................................... 14 Figure 12- Event-driven programming......................................................................................................... 14 Figure 13- Event-Driven Programming in Programming ............................................................................ 16 Figure 14- integrated development environment ......................................................................................... 18 Figure 15- Visual Studio 2019 interface ...................................................................................................... 18 Figure 16- Text editor in Visual Studio 2019............................................................................................... 19 Figure 17- Debug Mode in Visual Studio 2019 ........................................................................................... 20 Figure 18- Compiler in Visual Studio 2019 ................................................................................................. 21 Figure 19- Code completion in Visual Studio 2019 ..................................................................................... 21 Figure 20- Support programing language in Visual Studio 2019................................................................. 22 Figure 21- Integrations and additions in Visual Studio 2019 ....................................................................... 22 Figure 22- Start Debugging .......................................................................................................................... 24 Figure 23- Input Parcel’s Information .......................................................................................................... 25 Figure 24- Program in the debugging mode ................................................................................................. 26 Figure 25- Run to cursor............................................................................................................................... 27 Figure 26- Edit the code while the program Document is running ................................................................................ 28 shared on www.docsity.com Downloaded by: a-dc-1 ([email protected]) Figure 27- Autos window ............................................................................. Error! Bookmark not defined. Figure 28- Locals Window ........................................................................... Error! Bookmark not defined. Figure 29- Call Stack Window ..................................................................................................................... 28 Figure 30- Use IDE to write code................................................................................................................. 30

Figure 31- Using Word to code .................................................................................................................... 31 Figure 32- Source code CheckInfo ............................................................................................................... 32 Figure 33- Result of function CheckInfo...................................................................................................... 33 Figure 34- Source Code Add Product .......................................................................................................... 34 Figure 35- Class Product .............................................................................................................................. 35 Figure 36- Using Button Add ....................................................................................................................... 36 Figure 37- Source Code Cell Click .............................................................................................................. 37 Figure 38- Package charge function ............................................................................................................. 37 Figure 39- Cell Click Event.......................................................................................................................... 38 Figure 40- Source Code Button Edit ............................................................................................................ 39 Figure 41- Before Use Button Edit............................................................................................................... 40 Figure 42- After Use Button Click ............................................................................................................... 41 Figure 43- Source Code Button Remove...................................................................................................... 41 Figure 44- Before Use Button Remove ........................................................................................................ 42 Figure 45- After Use Button Remove .......................................................................................................... 43 Figure 46- Source Code Button Sort ............................................................................................................ 43 Figure 47- Before Use Button Sort............................................................................................................... 44 Figure 48- After Use Button Sort ................................................................................................................. 45 Figure 49- Source Code Button Exit ............................................................................................................ 45 Figure 50- Program exit message ................................................................................................................. 46 Figure 51- Example of comment .................................................................................................................. 47 Figure 52- Example of Method .................................................................................................................... 47 Figure 53- Example of brace rule ................................................................................................................. 48 Figure 54-Example of Indentation and spacing............................................................................................ 48 Figure 55- Example of Prefixes.................................................................................................................... 49

Table of Diagram Diagram 1- Function CheckInfo................................................................... Error! Bookmark not defined. Diagram 2- Button Add ................................................................................ Error! Bookmark not defined. Diagram 3- Cell Click Event ........................................................................ Error! Bookmark not defined. Diagram 4- Button Edit ................................................................................ Error! Bookmark not defined. Diagram 5- Button Remove.......................................................................... Error! Bookmark not defined. Diagram 6- Button Sort ................................................................................ Error! Bookmark not defined. Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

1. Introduction In Assignment 1, I presented the definition of an algorithm and raised a small problem and then solved it in C# using procedural programming. In this Assignment 2, I will give another problem and solve it using the Integrated Development Environment (IDE) with a combination of 3 programming styles that are procedural programming, object-oriented programming. and event-driven programming. In addition, I will introduce more about the debugging process as well as the importance of coding standards and naming conventions. My assignment will be divided into 4-chapter specifically as follows: • • • •

Chapter 1: Introduction to your program Chapter 2: Explain programming paradigms Chapter 3: IDE features Chapter 4: Design and Implementation

2. Chapter 1: Introduction to your program 2.1 Overview of the problem In the context of the current Covid19 situation, online shopping is emerging as an extremely safe and convenient solution. That's why shipping companies are growing day by day and because of that they need an application that can manage their warehouse orders. In that context, I would raise an issue as follows: A start-up freight company is in need of a Windows Form-based application that can help them manage their inventory. The program should have the following functions: view, add, delete, edit and sort packages. One piece of information about the package: product ID, product name, weight, destination. If the above information is missing, the program will display a message so that the user can add it. Packages will be charged a storage fee of 15000/Kg. If the package weighs less than 5 kg, the warehousing fee of the parcel will be 10000 VND/Kg.

2.2 List out application’s requirements According to the problem above, the program will need to have the following requirements: • • • •

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

There are functions: View, add, edit, delete, sort and charge for each order by The program needs a data table to be able to view the basic information of the order Allows users to enter data from the keyboard and then add it to the data table



Check if the user input data is missing or not

Here is the Use case that is the interface of the program that I designed to solve the above situation:

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

Figure 2- Software interface

3.Chapter 2: Explain programming paradigms 3.1 Procedural Programming •

Procedural programming definition

Procedural Programming (POP) is the first basic programming paradigm a new programmer will learn. Essentially, procedural programming is code that directly instructs a device how to complete a task in sequential order. Flowchart of the program's control flow organization. Procedural programming divides the program into functions if the program is too large. A function is simply a subroutine containing a series of steps to be performed. In a nutshell, Procedural Programming is writing a list of instructions for the computer to understand what Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

Figure 3- How Procedural programming runs the program



Characteristics of procedural programming Procedural programming languages make it easy for developers or programmers to build large application programs by dividing them into subroutines also known as functions. Procedural programming implements a top-down approach, i.e., a programming paradigm. In addition, procedural programming breaks down the application program into data structures, variables, and subroutines that can be easily used by users. Procedural programming languages or code are executed very quickly because they take up less memory resources. Furthermore, procedural programming languages allow developers to provide a greater degree of control as well as portable source code. Therefore, it can be said that procedural programming can be used to evaluate and analyze all the distinguishing areas of our lives. In addition, procedural programming provides better solutions for complex programs. (admin, 2015) •

Methods Methods in a procedural programming language are used to store and store a set of instructions that a procedure is run in is called a method. Also, it is used in programming languages with an access designation.



Functions A large program is divided into small procedures or functions also known as easily manageable functions. This reduces duplication of statements in the program to help Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

improve the readability and maintainability of the code. In addition, Functions can also be separated into modules that can be used for other programs. (Nguyen, 2019)

Figure 4- Function in C#

Document shared on www.docsity.com Downloaded by: a-dc-1 ([email protected])

Using procedural programming in the program Here is an example where...


Similar Free PDFs