Assignment2 for programing C Sharp Language, Assignments of Programming Languages

• About your program • Explain some programming paradigms: procedural programming, object-oriented programming, event programming and compare them with each other. • Explain the general features of the IDE and its use to manage your code development. • Evaluate application development using an IDE versus developing an application without using an IDE. • Explain and evaluate the debugging process in the IDE used and how it helped development. • Explain and evaluate the coding standards used in yo

Typology: Assignments

2020/2021

Uploaded on 09/18/2021

le-linh-dan
le-linh-dan 🇻🇳

4.5

(22)

9 documents

1 / 35

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Le Thi Phuong Anh_GCH200052 1
ASSIGNMENT 2 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Unit 1: Programming
Submission date
2/9/2021
Date Received 1st submission
Re-submission Date
Date Received 2nd submission
Student Name
Le Thi Phuong Anh
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
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23

Partial preview of the text

Download Assignment2 for programing C Sharp Language and more Assignments Programming Languages 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 2/9/2021 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Le Thi Phuong Anh 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 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

  • I.INTRODUCTION
    • I.1Problem statement
    • I.2 Scenario................................................................................................................................................................
  • II. PROGRMMING PARADIGMS
    • I.1 Procedural programming
    • I.2 Object Oriented Programming
    • I.3 Event-driven programming
    • I.4 Comparison
  • III PROGRAM RESULTS
    • III.1 Designing (Flowchart)
    • III.1.1 Input information
      • III.1.1 Add the book
      • III.1.2 Save information of book
      • III.1.3 Delete information of book
      • III.1.4 Add them all to the list Borrowed Comic
      • III.1.5 Remove them all to the list Lending Comic
      • III.1.6 Add each comic book to the list Borrowed Comic
      • III.1.7 Remove each comic book to the list Lending Comic
      • III.1.8 Show book rental result
      • III.1.9 Reset all the application............................................................................................................................
    • III.2 Explanation
      • III.2.1 Design
      • III.2.2 Code..........................................................................................................................................................
      • III.2.3 Result
  • IV IDE USAGE IN DEVELOPMENT
    • IV.1 Common IDE features.....................................................................................................................................
      • IV.2 IDE usage
      • IV.2.1 IDE used in my program
      • IV.2.2 Evaluation of IDE usage
  • V. DEBUGGING
    • V.1 Debugging process
    • V. 2 Evaluation
  • VI CODING STANDART
    • VI.1 Coding standard in program
  • REFERENCE LIST

I.INTRODUCTION

After passing the interview round with a presentation to demonstrate his problems solving ability and basic programming skills. Now, a more challenging task is to create a secure working application that is designed using an IDE and adheres to coding standards for a detailed business problem. Along with that is an explanation of programming languages I.1Problem statement The solution to a detailed business problem is to create an application using an IDE. It's an application that helps the management of a bookstore. The assigned task is to help staff manage book information including genre, title, author and producer when customers request to provide and learn. Besides, it is the management of book rental vouchers and purchase vouchers for books and goods of the store. The application will be designed using the Winforms of the Microsoft Visual Studio. I.2 Scenario Before going to the next part, let's build the scenario to complete the task better:

  • About your program
  • Explain some programming paradigms: procedural programming, object-oriented programming, event programming and compare them with each other.
  • Explain the general features of the IDE and its use to manage your code development.
  • Evaluate application development using an IDE versus developing an application without using an IDE.
  • Explain and evaluate the debugging process in the IDE used and how it helped development.
  • Explain and evaluate the coding standards used in your program and the benefits to the organizations that use them. II. PROGRMMING PARADIGMS I.1 Procedural programming Procedural programming “tells the computer exactly how to solve a problem, in a step-by-step manner. From the programmer's point of view, things were pretty simple. You knew what data to expect, where it would be found (usually a file on a mainframe computer), its exact format, and so on. With procedural programming, there were very few surprise - and very little user interaction” (Smiley, 2010). Or according to a study by Harvey (2013) Procedural Programming could be a term utilized to represent the way in

perform an action” (Clark, 2013). Further research (Farrell, 2017) OOP is an expansion of procedural programming. It has variables and methods like procedural programs do, but it centers on objects that contain the variables and methods. An object may be a concrete entity that has attributes and behaviors. The attributes of an object are the highlights it "has"; the values of an object's traits constitute the state of the object. Besides, Object-oriented programming is the de facto programming paradigm for many programming languages and it focuses on manipulating objects rather than the logic for manipulating them, making code manageable, reusable, and maintainable. When an object has the same properties, it will be grouped into an object class. Class can also be used to define a new data type. In other words, Layer is a pattern but object is an a current specifically based on that pattern. and will also have 2 components as properties and methods. Basic characteristics of OOP:

  • Encapsulation
  • Inheritance
  • Polymorphism
  • Abstraction Figure 2: Example about Class and Object

I.3 Event-driven programming According to Gittleman (2005) Event-driven programming may be a programming paradigm where the stream of execution is decided by events like clicks or inquiry comes about from a database. Events are dealt with by event handlers or event. “An event is something that causes an event- driven program to perform an action. This broad definition allows many programs to be understood as event – driven” (Williams, et al., 2019). In other words, Event Driven Programming is the dominant paradigm used in graphical user interfaces and other applications that focus on performing certain actions in response to user input. For example, a simple program that prints either Hello or World depending in user input: Figure 4: Example Characteristics:

  • Service-oriented: The main function is used to create a service program without affecting the computer's processing because the service is directed to the target service. It is usually a service that runs in the background of the operating system.
  • Time driven: In driven programming, timing is a pattern, it's a time code trigger, controlled timing can be a certain code running at a given time, can be once.
  • Event handler: A type of function or method that performs a certain action when an event is triggered.
  • Trigger functions: Functions to determine which software to run during the event and select an event manager to use to manage the event at runtime.
  • Events: Mouse, keyboard and user interface must be activated in the software program must interact with the item in the program.

III PROGRAM RESULTS

III.1 Designing (Flowchart) III.1.1 Input information III.1. 1 Add the book Figure 5: Button Add Click

III.1.2 Save information of book Figure 6: Button Save Click III.1. 3 Delete information of book Figure 7 : Button Delete Click

Figure 8: Button RemoveAll Click III.1. 6 Add each comic book to the list Borrowed Comic Figure 9: Button AddOne Click III.1.7 Remove each comic book to the list Lending Comic Figure 10 : Button RemoveOne Click

III.1.8 Show book rental result Figure 11: Button Result Click III.1. 9 Reset all the application Figure 1 3 : Button Reset Click

III.2.2 Code When the Form is displayed, the Save and Delete button will be hidden, after clicking Save, the Add button will be hidden again. To do this, we have the method below: Figure 19: Control Start the program running, without clicking add, will not be able to enter the information of the book “btnAdd.Enabled = true” and vice versa 'btnSave.Enable = false' and " btnDelete.Enable = false". When the add button is not activated, the application will not allow the user to enter data in the fields, only the command lines “txtType.ReadOnly = true”, .... Let the cursor tick on the Add button we use “btnAdd.Focus” to keep the cursor focused on. Same as above, but on the contrary, when 'Save' and "Delete" is enabled, the remaining function operations “btnAdd.Enabled = false” and “btn.Save.Enable = true” àn btn.Save.Enable = true" are not allowed. Once the application has allowed the user to Add, the fields will allow the user to enter the information of the book. At this point, the application will focus on the book genre. When the form is loaded, you need to lock the control immediately. The global variable Book is assigned to createTable().

Figure 21: Add information into Table To add product information, first we need to unlock the control and the flag variable makes it easier for the program to recognize the Add button. When entering new information, for quick operation, this data will be blank, then 'txtType.Text ', ... must be empty. With this save function will take all the data entered by the user then display it in the table (DataGridView) and then save. The if loop is executed with the '==' operator. If true, it will add all the data entered to the table. Need to check if the user entered enough data. Add an if loop to check the data, if true, the application will work, if it is wrong, it will report an error. After entering the data, it will force the information fields into the DataTable and then add it to the DataGirdBook. After successful saving, the control will be locked to continue entering new book information:

Besides adding or moving the entire list of comics between ListBoxes, there is also transferring individual comic books. And it is similar. Click on the object you want to select. The Add attribute will move the comic book in lstLending to be added to lstBorrowed. Then its position in lstLending will disappear by using Remove. To display the results for customer name, customer ID, book rental date, total number of comics rented and names of comic types rented, I use a for loop to return the number of elements in lstBorrowed. I set the SelectedIndex to a valid value (equal to i), the selection goes to the corresponding object when we select the number of elements in the ListBox To pay library bills including comic book rentals and book purchases, I use an if statement to check we use the checked property of the CheckBox along with the operator "==". If selected, the price of the book is equal to the price multiplied by the number of books. It is applicable to chkNovel, chkComic, chkPoem, chkManazine and chkEncyclopedia. And the total bill at this time is equal to the money of the books plus the rental of comic books (depending on the needs of the customer to calculate the money). MessageBox is a class in C# and Show is a method that displays a message of the Form. Thus, the number will appear on the screen with the Name of customer, Customer's ID, time and total payment. Reset Customer name, Customer ID, time, result and Total Invoice using ResetText() - Reset Text property to default value (Empty). Finally close the application with Close().

Figure 28: Reset and Exit application III.2.3 Result When the application starts running, we will enter the above and ID, the time before the purchase. Next, there are two events that are Add and Save for the user to choose. To enter the information of the books, click on add. Information of the books is entered from the keyboard at the request of the customer. When the information in that Information of Book will be saved to the table by the Save event. The add event allows the user to enter additional information when requested. Figure 29: Add information