Download Assignment 2 - Programming - Pass and more Assignments Computer Science 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 29 /12/2021 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Huynh Minh Huy Student ID GCD Class GCD1001 Assessor name Do Duy Thao 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 (^) Huy Grading grid P2 P3 P4 P5 M2 M3 M4 D2 D3 D
❒ Summative Feedback: ❒ Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
Acknowledgement First and foremost, I want to thank the curators at the University of Greenwich for making these courses available to students. I would want to thank all of the writers and researchers who worked on this data. Furthermore, I would like to thank teacher Do Duy Thao for his excellent and professional lectures and tutorials. Finally, I would want to thank our university's lecturers and administrative personnel for creating a positive learning atmosphere.
Table of Contents
CHAPTER 1: Introduction To Your Program.
- Introduce the Overview/ Context of the problem. In the first assignment report, I provided a brief overview of the C# programming language and addressed a basic issue. Based on this information, I will investigate how to utilize an integrated development environment (IDE) to design a program and produce a fully functional application utilizing IDE. Furthermore, many approaches and assessment methods will be appropriate for your project.
- List out application’s requirements. In this assignment, I will create a Hotel Management Application that will let users to interact with it and conduct specified C.R.U.D. (Create/Read/Update/Delete) actions: Create: Create a list of customers and allow user add customers into a list. Read: Read the information that user input to application and print it to screen. Update: Update previously-stored log information. It replaces the old information by new data. Delete: Remove existing data added from Create.
CHAPTER 2: Explain Programming Paradigms.
- Explain what is Procedural Programming with source code and illustrations. 1.1. What is Procedural Programming? Procedural Programming may be the first programming paradigm that a new developer will learn. Procedural code, in its most basic form, is the code that tells a device how to do a job in logical stages. This paradigm takes a top-down, linear approach to data and operations, and regards them as two distinct things. Procedural Programming splits a program into procedures, which are sometimes known as routines or functions and simply comprise a set of actions to be carried out, based on the notion of a procedure call. Simply put, Procedural Programming involves writing down a list of instructions to tell the computer what it should do step-by-step to finish the task at hand. (Bhatia, 2021) Procedural Programming has its own set of advantages and disadvantages, some of which are listed here. Advantages: Procedural Programming is excellent for general-purpose programming. The coded simplicity along with ease of implementation of compilers and interpreters. Figure 1 : Procedural Programming.
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 that function, 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. Figure 3 : Local Variable. Figure 4 : Global Variable.
Modularity: Modularity is when two dissimilar systems have two different tasks at hand but are grouped together to conclude a larger task first. The duties of each set of systems would then be completed one by one until all of the tasks had been completed. Figure 5 : Program.cs system. Figure 6 : AirlineBookingManager.cs sytem
- Explain what is Object-Oriented Programming with source code and illustrations. 2.1. What is Object-Oriented Programming? Object-oriented programming (OOP) is a programming paradigm that organizes software design around data, rather than functions and logic. An object is a type of data field that has unique features and behavior. OOP focuses on the objects that developers desire to handle rather than the reasoning needed to do so. This programming style is ideal for large, sophisticated projects that are constantly updated or maintained. This encompasses industrial and design software, as well as mobile apps; for example, OOP may be used to create manufacturing system simulation software. (Gillis, 2021) 2.2. What is the structure of Object-Oriented Programming? Classes are data types that are established by the user and serve as the blueprint for individual objects, properties, and actions. Objects are instances of a class that are formed with specified data. Items can be real-world objects or abstract entities. When a class is first formed, the description is the sole object specified. Figure 8 : Object-Oriented Programming. Figure 9 : Class and Object in OOP.
Methods are functions specified within a class that explain an object's actions. Every method in a class definition begins with a reference to an instance object. In addition, the subroutines included within an object are referred to as instance methods. Methods are used by programmers to ensure reusability or to keep functionality confined within a single object at a time. Attributes are defined in the class template and describe an object's state. Data will be saved in the attributes field of objects. Class characteristics are the property of the class itself. 2.3. What are the main principles of OOP? Object-Oriented Programming is based on the following principles: Encapsulation: This property does not enable the user to directly modify the data inside the object, but rather requires the user to utilize the methods provided by the object. This attribute protects the object's integrity. Abstraction: Objects only expose internal mechanisms that are essential for the usage of other objects, while masking any extraneous implementation code. The functionality of the derived class can be expanded. This notion can make it easier for developers to make further adjustments or additions over time. Inheritance: Inheritance allows building a new class (Subclass), inheriting and reusing properties and methods based on the old class (Parentclass that existed before. Figure 10 : Principles of OOP.
- The relationships between Procedural Programming , Object-Oriented Programming and Event-Driven Programming. Event-Driven Programming Procedural Programming Object-Oriented Programming Creates applications using a graphical user interface. Provide a graphical user interface for entering instructions. Provides command writing in modules. On events, actions are defined. These events might be triggered by mouse clicks and movements, as well as keyboard strokes. Commands are written in a linear form and are likewise executed in a linear method. Objects and functions are ready for interaction in order to complete certain tasks. The emphasis is on selecting the user interface. The emphasis is on the sequential execution of steps. Focuses on things or data and facilitates but does not safeguard them from illegal access. Most common language which follow this paradigm are Visual Basic and C# Most common language which follow this paradigm are Basic FORTRAN and COBOL. Most common language which follow this paradigm are Smalltalk, C++ and Java. Table 1 : The relationships between Procedural Programming, Object-Oriented Programming and Event-Driven Programming.
- Conclude which paradigms will be used to develop the application with explanation. I chose Object Oriented Programming (OOP) to construct my Hotel Management System for the following two reasons: Modularity facilitates troubleshooting: The beauty of feature encapsulation is in its simplicity. This means that each piece of functionality operates independently of the others. An IT staff may also work on many issues at the same time, eliminating the possibility of someone stealing someone else's talents. For example, if there is an issue with the data, I just go to the class which have that data to check and rectify it rather than spending time looking. Effective issue solving: Once I get the hang of it, OOP is usually the most natural and practical method. Because of OOP languages, I can divide my software into bite-sized problems that I can then handle one object at a time.
CHAPTER 3: IDE Features.
- Introduction of IDE. An Integrated Development Environment (IDE) is a software application that provides computer programmers with powerful software creation tools. A source code editor, construction automation tools, and a debugger are typically included in an integrated development environment (IDE). The majority of today's IDEs include intelligent code completion. Some IDEs include a compiler, an interpreter, or both.
- Introduction of features of IDE with illustration. Compiler: Compilers are modules that translate programming languages into computer- readable formats. The computer code is examined to guarantee its consistency. Debugger: Programmers and software engineers will typically inspect and find errors in different segments of code. To assess features and efficiency, they usually employ simulations of real- world scenarios. Figure 11 : Compiler of Visual Studio Community.
Programming language support: IDEs are often restricted to a single programming language, while some do support several languages. Tools such as Ruby, Python, C#, and Java are a few examples. Integrations and plugins: Your IDE is your software hub, encompassing all of your other development resources to improve development process and competitiveness. Poor integration can cause a slew of issues and hassles.
- An explanation and evaluation of the debugging process in the IDE used and how it helped with development. 3.1. Definition. Debugging is the act of finding and eliminating current and prospective flaws (often known as "bugs") in software code that might cause it to behave unexpectedly or crash. Debugging is used to detect and address faults or problems in software or systems to avoid erroneous functioning. Debugging becomes more difficult when several subsystems or modules are tightly connected, as each modification in one module may cause more defects to arise in another. Debugging a software can sometimes take longer than coding it. Figure 14 : Visual Studio supports multiple programming language.
3.2. Process Of Debugging. Identify Error: Detecting problems early on may save a lot of time. We waste a lot of time if we make a mistake in detecting an error. Errors or defects that arise at a client location are difficult to locate. Identifying the correct mistake is critical for saving time and avoiding problems at the user site. Identify The Error Location: After discovering an issue, we must pinpoint the precise area in the code where the problem occurred. Identifying the specific spot that causes the mistake might assist you solve the problem more quickly. Analyze Error: You must use an appropriate technique to examine the mistake at this step. This will assist you in comprehending the issue. This stage is essential since correcting one inaccuracy may result in another. Prove The Analysis: Once the detected problem has been evaluated, you must turn your attention to additional software faults. This procedure entails test automation, which requires you to develop test cases using the test framework. Cover Laternal Damage: At this point, you must do unit testing on all of the code where changes are made. If all test cases pass the test, you can go to the next stage; otherwise, you must resolve the test case that fails the test. Correct and validate: This is the final stage of the debugging process, during which you must fix all errors and test all test scripts. 3.3. Advantages of Debugging. Saves Time: Performing debugging at the beginning saves time for software developers since it allows them to avoid using complicated codes in software development. It not only saves software developers' time but also their energy. Reports Errors: It provides error reports as soon as they occur. This enables for the discovery of errors at an early stage, reducing stress throughout the software development process. Easy Interpretations: It gives simple interpretations by offering additional information about data structures. Publish bug-free software: By detecting problems in software, developers are able to remedy them before delivering it to clients, resulting in bug-free software.
- Debugging During Implementation. Because debugging tools are so strong and useful. I can quickly detect flaws and issues with their assistance without having to thoroughly examine every line of code. In addition, with object- oriented programming, the debugger's usefulness truly shined out in specific situations.