

















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


















































Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date 8/29/2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name 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
Grade: Assessor Signature: Date: Lecturer Signature:
I. Task 1 – Introduction to your program (P3) I use Library Management System scenario to demonstrate on Visual studio Library Management System A software for online movie ticket booking system facilitates the purchasing of movie tickets to its customers. It allows the customers to browse through available movies and book seats, the admin to check the for the booking information.
class Parrot: pass obj = Parrot() class obj (^) Parrot Class A class is a blueprint for the object. We can think of class as a sketch of a parrot with labels. It contains all the details about the name, colors, size etc. Based on these descriptions, we can study about the parrot. Here, a parrot is an object. The example for class of parrot can be : Here, we use the keyword to define an empty class Parrot. From class, we construct instances. An instance is a specific object created from a particular class. Object An object (instance) is an instantiation of a class. When class is defined, only the description for the object is defined. Therefore, no memory or storage is allocated. The example for object of parrot class can be: Here, is an object of class Four Principles of OOP The four pillars of object-oriented programming are: Inheritance: child classes inherit data and behaviors from parent class Encapsulation: containing information in an object, exposing only selected information Abstraction: only exposing high level public methods for accessing an object Polymorphism: many methods can do the same task Inheritance Inheritance allows classes to inherit features of other classes. Put another way, parent classes extend attributes and behaviors to child classes. Inheritance supports reusability.
Notice that the HerdingDog class does not have a copy of the showInfo() method, it inherits the showInfo() method defined in the parent Dog class. When the code calls hDog.showInfo() method, the showInfo() method walks up the chain of child to parent classes, to find where the showInfo method is defined. Encapsulation Encapsulation means containing all important information inside an object, and only exposing selected information to the outside world. Attributes and behaviors are defined by code inside the class template. Then, when an object is instantiated from the class, the data and methods are encapsulated in that object. Encapsulation hides the internal software code implementation inside a class, and hides internal data of inside objects. Encapsulation requires defining some fields as private and some as public. Private / Internal interface: methods and properties, accessible from other methods of the same class. Public / External Interface: methods and properties, accessible also from outside the class. Encapsulation adds security. Attributes and methods can be set to private, so they can’t be accessed outside the class. To get information about data in an object, public methods & properties are used to access or update data. This adds a layer of security, where the developer chooses what data can be seen on an object by exposing that data through public methods in the class definition. Within classes, most programming languages have public, protected, and private sections. Public is the limited selection of methods available to the outside world, or other classes within the program. Protected is only accessible to child classes. Private code can only be accessed from within that class. To go back to our dog/owner example, encapsulation is ideal so owners can’t access private information about other people’s dogs.
Consider the getName(), getAge() methods in our example code, Attributes are hidden inside the Dog class. The hDog object uses the getName() and getAge() method to return the object information. Abstraction Abstraction means that the user interacts with only selected attributes and methods of an object. Abstraction uses simplified, high level tools, to access a complex object. Using simple things to represent complexity Hide complex details from user Abstraction is using simple classes to represent complexity. Abstraction is an extension of encapsulation. For example, you don’t have to know all the details of how the engine works to drive a car. A driver only uses a small selection of tools: like gas pedal, brake, steering wheel, blinker. The engineering is hidden from the driver. To make a car work, a lot of pieces have to work under the hood, but exposing that information to the driver would be a dangerous distraction.
In a typical even-driven application, there is a main loop that listens for even and then calls an callback function when one is detected. Instead of a continually running main loop, hardware interrupts can be used in embedded systems to accomplish the same result. Event-driven applications may be developed in any programming language, however, languages with high-level abstractions, such as to await and closures, make the work simpler.
modules are tightly coupled, debugging becomes harder as any change in one module may cause more bugs to appear in another. Sometimes it takes more time to debug a program than to code it. b. The debugging process Problem identification and report preparation. Assigning the report to the software engineer to the defect to verify that it is genuine. Defect Analysis using modeling, documentation, finding and testing candidate flaws, etc. Defect Resolution by making required changes to the system. Validation of corrections. The debugging process will always have one of two outcomes :
Press Start Debugging (F5) Some basic functions to use: Step into (F11) (Debug > Step Into is the Step Into command and advances the app execution one statement at a time. When you start the app with F11, the debugger breaks on the first statement that gets executed. Step Over(F10): Run passes through each function in the code, but does not stop inside each method After debugging, if you want to exit this function, select Stop Debugging (Shift + F5) on the toolbar or select Debug on the toolbar and select Stop Debugging
Inside file Cinema.cs I declared two class Movie and HideShow with a similar variable. The only thing different between them is class HideShow does not have array string of show in order to display the class information on the data grid view. Both class serve a similar purpose is to store the movie information and display them later. The HideShow class does not have array string show In file form MovieBooking I create function DisplayDGV to transfer any class List into Data Grid View and show the stored information to the user.
The function takes class list pass through the parameter and display in Data Grid View I created two sort function with a similar solution, one for sorting by Titles in the list by alphabet and the other is for sorting by City Names. Both of them pass class list through parameter and execute them.