Docsity

PROGRAMING AND asigment 2, Essays (university) of Algorithms and Programming

Toggle sidebar
bg1
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
TRAN LE DUY
Student ID
BH00460
Class
IT601
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
DUY
Grading grid
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b

Partial preview of the text

Download PROGRAMING AND asigment 2 and more Essays (university) Algorithms and Programming in PDF only on Docsity!

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 TRAN LE DUY Student ID BH Class IT601 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 DUY Grading grid

TABLE OF CONTENT

  • P2 P3 P4 P5 M2 M3 M4 D2 D3 D
  • I) PROGRAM SETTING MODELS
  • 1.STRUCTURED/PROCEDURAL DRIVEN PROGRAMMING
  • 2.OBJECT DRIVEN PROGRAMMING:
  • 3.EVENT-DRIVENT PROGRAMMING
    1. THE RELATIONSHIP BETWEEN THE ABOVE 3 PROGRAMMING MODELS
  • II)ALGORITHM SETTINGS IDE.........................................................................................................................................
  • 1)INTRODUCE
  • 2)SET UP
  • III) DEBUG PROCESS
  • 1.DEFINITION:
    1. PROS:
  • 3.DEBUG PROCESS:
  • IV) STANDARD CODE:
  • 1.STANDARD CODE WRITING :
  • 2.CODING STANDARDS USED IN THE PROGRAM
  • V) SYNTHESIZE INFORMATION:.....................................................................................................................................

I) Program setting models

1.Structured/Procedural driven Programming

 A programming model that divides a program into functions or subroutines. Each program can also be divided into many other subroutines to simplify their work.  Structure-oriented structure setting characteristics  Focus on the work to be done (algorithm)  A large program is divided into subroutines, each of which can be called one or more times in any order.  Most functions use common data  Secondary data in the system are moved from one function to another.  Function that transforms data from one form to another  Using a top-down approach in program design  Simple, easy implementation of compilers and interpreters  The ability to re-use the same code at different places in the program without copying it.  An easier way to keep track of program flow.  The ability to be strongly modular or structured.  Needs only less memory.  Programs are more easily and more quickly written  Programs are reliable as fewer organizational and logical errors occur during the initial stages of program development.

3.Event-drivent programming

 is a computer programming model that designs software around data, or  objects, instead of functions and logic.  Characteristic:  • Abstraction: Representing complexity in a set of values by a simple model that focuses on important characteristics of the object in each situation.  • Inheritance: Build a new class based on an existing one: Base class > Derived class  • Encapsulation: A set of abstract components encapsulated into a class with the concept of information hiding.  • Polymorphism: The mutation of derived classes  In an event-driven application, there is generally a main loop that listens for events and then triggers a callback function when one of those events is detected. In embedded systems, the same may be achieved using hardware interrupts instead of a constantly running main loop. Event-driven programs can be written in any programming language, although the task is easier in languages that provide high-level abstractions, such as await and closures.

4. The relationship between the above 3 programming models

 Procedural programming is only used to teach programming for beginners or algorithms for thinking, breaking problems into small problems. It doesn't work in large systems.  Object-driven programming, it applies to large systems and problems. However, it has not been used for practical applications.  To create a real application, object-oriented and event-driven programming models must be used to build a real application system.  In structured programming, the problem is taken, and analyzed from top to bottom, when you find a logical situation too complex, you try to divide it into parts (like pizza slices). The idea is to divide the logical complexity into functions or procedures that are easy to understand and solve. The classic, divide and win.  If properly worked, functions or procedures will appear that are reused in different parts of the code.  With OOP, on the other hand, the approach is to discover the elements involved in the problem (people, documents, products, etc.) by analyzing the data (properties) that each one manages, together with the methods (which are nothing other than functions or methods). Then, you create derived classes (sub-classes) of the main classes (for example of people: employees, suppliers, customers, etc.) that reuse the methods and properties of the main class (inherit) and add the specific ones.  In event-oriented programming, procedures, objects, methods etc. They "fire" when an "event" occurs (mouse click, keyboard click, window activation, etc.) and is common when you have to program a GUI. Generally, the code is distributed in a structured way in the application (modules, libraries) where classes and subclasses are defined. If the application has to work with events, in some part of the code the events will be associated with the procedures, functions or methods that manage them.  Personally, I use a combination of these three paradigms. But in any case, it depends on what type of program is being solved.

  • To manage workers, class workers need to declare *In the code above I created properties for objects so that other classes can be retrieved.

2)Set up

**Once set up to perform the operation on the button so that the program can operate: With the Add button I have set Employee = NEW EMPLOYEE based on EMPLOYEE from which it will inherit the properties of EMPLOYEE EMPLOYEE[] listEMPLOYEE = new EMPLOYEE[100]; int n = 0; private void ADDbt_Click_1(object sender, EventArgs e) { EMPLOYEE employeezzz = new EMPLOYEE(); employeezzz.NAME = txtNAME.Text; employeezzz.JOBS = txtJOBS.Text; employeezzz.ADDRESS = txtADDRESS.Text; employeezzz.AGE = txtAGE.Text; employeezzz.EXPERIENCE = txtEXPERIENCE.Text; listEMPLOYEE[n] = employeezzz; n++; display(); } public void display() { dgvEMPLOYEE.DataSource = null; dgvEMPLOYEE.DataSource = listEMPLOYEE; dgvEMPLOYEE.Refresh(); } int ind; // Of course we need to configure the display at this button private void dgvEMPLOYEE_CellClick_1(object sender, DataGridViewCellEventArgs e) { ind = e.RowIndex; txtJOBS.Text = listEMPLOYEE[ind].JOBS.ToString(); txtNAME.Text = listEMPLOYEE[ind].NAME.ToString(); txtADDRESS.Text = listEMPLOYEE[ind].ADDRESS.ToString(); txtAGE.Text = listEMPLOYEE[ind].AGE.ToString();

******And of course, the button exit : this button just needs a simple command line that commands the computer in C language.# :** private void EXITbt_Click(object sender, EventArgs e) { Application.Exit(); ** In addition I created a new window form for the application's login screen

I installed the security app by creating a user and password via the login button with the IF and else command : private void btLOGIN_Click(object sender, EventArgs e) { if(txtuser.Text == "leduy" && txtpassword.Text == "123456") { new Form1().Show(); this.Hide(); } else { MessageBox.Show(" Wrong"); txtuser.Clear(); txtpassword.Clear(); } } } }

  • Reconfigure form 1 to 2 so that form 2 will display first: using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp { internal static class Program { /// /// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form2()); }