Higher Nationals Internal verification of assessment decisions – BTEC (RQF) INTERNAL VERIFICATION – ASSESSMENT DECISIONS Programme title Higher National Diploma in Computing Assessor Ms.Shifani Internal Verifier Unit 01: Programming Unit(s) Assignment title Rahmathulla Mohommed Reeza Student’s name List which assessment criteria the Assessor has awarded. Pass Merit Distinction INTERNAL VERIFIER CHECKLIST Do the assessment criteria awarded match those shown in the assignment brief? Is the Pass/Merit/Distinction grade awarded justified by the assessor’s comments on the student work? Has the work accurately? been assessed assessment decision Y/N Y/N Is the feedback to the student: Give details: • Constructive? • Linked to relevant assessment criteria? • Identifying opportunities for improved performance? • Agreeing actions? Does the amending? Y/N Y/N Y/N Y/N Y/N need Y/N Assessor signature Date Internal Verifier signature Date Programme Leader signature (if required) Date 1 R.M.Reeza Programming Assignment 01 Confirm action completed Remedial action taken Give details: Assessor signature Ms.Shifani Date Internal Verifier signature Date Programme Leader signature (if required) Date R.M.Reeza 01 Programming 2 Assignment Higher Nationals - Summative Assignment Feedback Form Student Name/ID Unit Title Assignment Number Rahmathulla Mohommed Reeza/KAN00078673 Unit 01 : Programming 1 Ms.Shifani Assessor Submission Date Date Received 1st submission Re-submission Date Date Received submission 2nd Assessor Feedback: LO1. Define basic algorithms to carry out an operation and outline the process of programming an application. Pass, Merit & Distinction Descripts P1 M1 D1 LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis of a Integrated Development Environment (IDE). Pass, Merit & Distinction Descripts P2 M2 D2 M3 D3 LO3. Implement basic algorithms in code using an IDE. Pass, Merit & Distinction Descripts P3 LO4. Determine the debugging process and explain the importance of a coding standard. Pass, Merit & Distinction Descripts Grade: P4 P5 M4 Assessor Signature: Date: Assessor Signature: Date: D4 Resubmission Feedback: Grade: Internal Verifier’s Comments: Signature & Date: * Please note that grade decisions are provisional. They are only confirmed once internal and external moderation has taken place and grades decisions have been agreed at the assessment board. Assignment Feedback R.M.Reeza 01 Programming 3 Assignment Formative Feedback: Assessor to Student Action Plan Summative feedback Feedback: Student to Assessor Assessor signature Date Student signature Date R.M.Reeza 01 Programming 4 Assignment Pearson Higher Nationals in Computing Unit 01: Programming Assignment 01 R.M.Reeza 01 Programming 5 Assignment General Guidelines 1. A Cover page or title page – You should always attach a title page to your assignment. Use previous page as your cover sheet and make sure all the details are accurately filled. 2. Attach this brief as the first section of your assignment. 3. All the assignments should be prepared using a word processing software. 4. All the assignments should be printed on A4 sized papers. Use single side printing. 5. Allow 1” for top, bottom , right margins and 1.25” for the left margin of each page. Word Processing Rules 1. 2. 3. 4. The font size should be 12 point, and should be in the style of Time New Roman. Use 1.5 line spacing. Left justify all paragraphs. Ensure that all the headings are consistent in terms of the font size and font style. Use footer function in the word processor to insert Your Name, Subject, Assignment No, and Page Number on each page. This is useful if individual sheets become detached for any reason. 5. Use word processing application spell check and grammar check function to help editing your assignment. Important Points: 1. It is strictly prohibited to use textboxes to add texts in the assignments, except for the compulsory information. eg: Figures, tables of comparison etc. Adding text boxes in the body except for the before mentioned compulsory information will result in rejection of your work. 2. Carefully check the hand in date and the instructions given in the assignment. Late submissions will not be accepted. 3. Ensure that you give yourself enough time to complete the assignment by the due date. 4. Excuses of any nature will not be accepted for failure to hand in the work on time. 5. You must take responsibility for managing your own time effectively. 6. If you are unable to hand in your assignment on time and have valid reasons such as illness, you may apply (in writing) for an extension. 7. Failure to achieve at least PASS criteria will result in a REFERRAL grade . 8. Non-submission of work without valid reasons will lead to an automatic RE FERRAL. You will then be asked to complete an alternative assignment. 9. If you use other people’s work or ideas in your assignment, reference them properly using HARVARD referencing system to avoid plagiarism. You have to provide both in-text citation and a reference list. R.M.Reeza 01 Programming 6 Assignment 10. If you are proven to be guilty of plagiarism or any academic misconduct, your grade could be reduced to A REFERRAL or at worst you could be expelled from the course Student Declaration I hereby, declare that I know what plagiarism entails, namely to use another’s work and to present it as my own without attributing the sources in the correct way. I further understand what it means to copy another’s work. 1. I know that plagiarism is a punishable offence because it constitutes theft. 2. I understand the plagiarism and copying policy of the Edexcel UK. 3. I know what the consequences will be if I plagiaries or copy another’s work in any of the assignments for this program. 4. I declare therefore that all work presented by me for every aspects of my program, will be my own, and where I have made use of another’s work, I will attribute the source in the correct way. 5. I acknowledge that the attachment of this document signed or not, constitutes a binding agreement between myself and Edexcel UK. 6. I understand that my assignment will not be considered as submitted if this document is not attached to the attached. Student’s Signature: (Provide E-mail ID) R.M.Reeza 01 Date: (Provide Submission Date) Programming 7 Assignment Higher National Diploma in Computing Assignment Brief Student Name /ID Number Unit Number and Title Unit 01: Programming Academic Year 2021/22 Unit Tutor Assignment Title Design &Implement a GUI based system using a suitable Integrated Development Environment Issue Date Submission Date IV Name & Date Submission Format This submission will have 3 components 1. Written Report This submission is in the form of an individual written report. This should be written in a concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. (The recommended word count is 1,500–2,000 words for the report excluding annexures) 2. Implemented System (Software) The student should submit a GUI based system developed using an IDE. The system should connect with a backend database and should have at least 5 different forms and suitable functionality including insert, edit and delete of main entities and transaction processing. 3. Presentation With the submitted system student should do a presentation to demonstrate the system that was developed. Time allocated is 10 to 15 min. Student may use 5 to 10 PowerPoint slides while doing the presentation, but live demonstration of the system is required. Evaluator will also check the ability to modify and debug the system using the IDE. R.M.Reeza 01 Programming 8 Assignment Unit Learning Outcomes: LO1. Define basic algorithms to carry out an operation and outline the process of programming an application. LO2. Explain the characteristics of procedural, object-orientated and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE). LO3. Implement basic algorithms in code using an IDE. LO4. Determine the debugging process and explain the importance of a coding standard R.M.Reeza 01 Programming 9 Assignment Assignment Brief and Guidance: Activity 1 A. The Fibonacci numbers are the numbers in the following integer sequence. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation. Fn = F n-1 + F n-2 B. Factorial of a non-negative integer is multiplication of all integers smaller than or equal to n. For example, factorial of 6 is 6*5*4*3*2*1 which is 720. n! = n * (n - 1) * … 1 Define what an algorithm is and outline the characteristics of a good algorithm. Write the algorithms to display the Fibonacci series and the factorial value for a given number using Pseudo code. Determine the steps involved in the process of writing and executing a program. Take a sample number and dry run the above two algorithms. Show the outputs at the end of each iteration and the final output. Examine what Big-O notation is and explain its role in evaluating efficiencies of algorithms. Write the Python program code for the above two algorithms and critically evaluate their efficiencies using Big-O notation. Activity 2 2.1 Explain what a Programming Paradigm and the main characteristics of Procedural, Object oriented and Event-driven paradigms and the relationships among them, mean. Write small snippets of code as example for the above three programming paradigms using a suitable programming language(s). You also need to critically evaluate the code samples that you have given above in relation to their structure and the unique characteristics. Activity 3 and Activity 4 are based on the following Scenario. R.M.Reeza 01 Programming 10 Assignment Ayubo Drive is the transport arm of Ayubo Leisure (Pvt) Ltd, an emerging travel & tour company in Sri Lanka. It owns a fleet of vehicles ranging from cars, SUVs to vans. The vehicles that it owns are hired or rented with or without a driver. The tariffs are based on the vehicle type. Some of the vehicle types that it operates are, small car, sedan car, SVUs, Jeep (WD), 7-seater van and Commuter van. New vehicle types are to be added in the future. Vehicle rent and hire options are described below. 1. Rent (With or without driver) – For each type of vehicle rates are given per day, per week and per month. Rate for a driver also given per day. Depending on the rent period the total rent amount needs to be calculated. For example: if a vehicle is rented for 10 days with a driver, total amount to be calculated as follows: Total rent = weeklyRent x 1 + dailyRent x 3 + dailyDriverCost x 10 2. Hire (with driver only) – These are based on packages such as airport drop, airport pickup, 100km per day package, 200km per day package etc. Standard rates are defined for a package type of a vehicle typeif that is applicable for that type of vehicle.For each package maximum km limit and maximum number of hours arealso defined. Extra km rate is also defined which is applicable if they run beyond the allocated km limit for the tour. For day tours if they exceed max hour limit,a waiting charge is applicable for extra hours. Driver overnight rate and vehicle night park rate also defined which is applicable for each night when the vehicle is hired for 2 or more days. Activity 3 Function 1: Rent calculation. Return the total rent_value when vehicle_no, rented_date, return_date, with_driver parameters are sent in. with_driver parameter is set to true or false depending whether the vehicle is rented with or without driver. Function 2: Day tour - hire calculation. Calculate total hire_value when vehicle_no, package_type, start_time, end_time, start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge, waiting_charge and extra_km_charge as output parameters. Function 3: Long tour - hire calculation. R.M.Reeza 01 Programming 11 Assignment Calculate total hire_value when vehicle_no, package_type, start_date, end_date, start_km_reading, end_km_reading parameters are sent in. Should return base_hire_charge, overnight_stay_charge and extra_km_charge as output parameters. Write suable algorithms for vehicle tariff calculation for rents and hires. Ideally, 3 functions should be developed for this purpose as above. Use the visual studio IDE (using C#.net) to Implement the above algorithms and design the suitable database structure for keeping the tariffs for vehicle types and different packages which must be used for implementing the above functions. Analyze the features of an Integrated Development Environment (IDE) and explain how those features help in application development. Evaluate the use of the Visual StudioIDE for your application development contrasted with not using an IDE. Activity 4 4.1 Design and build a small system to calculate vehicle hire amounts and record them in a database for customer billing and management reporting forAyubo drive. This includes the completing the database design started in 3.2 and implementing one or more GUIs for vehicle, vehicle type, and package add/edit/delete functions. It essentially requires an interface for hire calculation and recording function described above. Generating customer reports and customer invoices are not required for this course work. 4.2 Explain debugging process and the features available in Visual studio IDE for debugging your code more easily. Evaluate how you used the debugging process to develop more secure, robust application with examples. 4.3 Outline the coding standards you have used in your application development. Critically evaluate why a coding standard is necessary for the team as well as for the individual. R.M.Reeza 01 Programming 12 Assignment R.M.Reeza 01 Programming 13 Assignment Acknowledgment In preparation for our assignment, we had to take the help and guidance of some respected people, who deserve our deepest gratitude. As the competition for this assignment gave us much pleasure, we would like to show our gratitude to Ms.Shifani, lecturer-IT, on ESOFT Metro Campus, Kandy for giving us good guidelines for the assignment throughout numerous meetings. We would like to expand our gratitude to all those who have directly and indirectly guided us in doing this assignment. R.M.Reeza 01 Programming 14 Assignment Contents Acknowledgment ......................................................................................................... 14 Contents ....................................................................................................................... 15 Table of Figure ............................................................................................................. 15 Activity 01.................................................................................................................... 16 Algorithm ..................................................................................................................... 16 Characteristics of a Good Algorithm ........................................................................... 17 Pseudo Code ................................................................................................................. 17 Advantages of pseudo code...................................................................................... 18 B) Pseudo code .......................................................................................................... 22 Big O notation .............................................................................................................. 24 Activity 2...................................................................................................................... 26 What is Programming Paradigm .................................................................................. 26 Procedural Programming ............................................................................................. 26 Characteristics of procedural programming ............................................................. 27 Object Oriented ............................................................................................................ 28 Characteristic of Object Oriented ............................................................................ 29 Event-driven Paradigm ................................................................................................ 29 Characteristics of Event-driven ................................................................................ 30 Activity 03.................................................................................................................... 32 Rent Calculater ............................................................................................................. 33 Day Tour-Hire Calculater ............................................................................................ 34 Long Tour Calculater ................................................................................................... 35 Integrated Development Environment (IDE) .............................................................. 36 Features of integrated development environment .................................................... 36 Activity 4...................................................................................................................... 38 Vehicle Hiring System ................................................................................................. 39 What is Debugging? ..................................................................................................... 41 Visual studio IDE for Debugging ................................................................................ 42 Reference ..................................................................................................................... 49 Table of Figure Figure 1 Python Coding ............................................................................................... 22 Figure 2 Python Coding ............................................................................................... 24 R.M.Reeza 01 Programming 15 Assignment Figure 3 Procedural Programming coding ................................................................... 28 Figure 4 Object Oriented coding .................................................................................. 29 Figure 5 Event driven coding ....................................................................................... 32 Figure 6 System page 1 ................................................................................................ 39 Figure 7 System Page 2 ................................................................................................ 40 Figure 8 System page 3 ................................................................................................ 40 Activity 01 Algorithm An algorithm is an effective step-by-step procedure for solving a problem in a finite number of steps, in other words, it is a finite set of well-defined instructions or stepby-step description of the procedure written in human readable language for solving a given problem. An algorithm itself is division of a problem into small steps which are ordered in sequence and easily understandable. Algorithms are very important to the way computers process information, because a computer program is basically an algorithms that tells computer. What specific tasks to perform in what specific order R.M.Reeza 01 Programming 16 Assignment to accomplish a specific task. The same problem can be solved with different methods. so, for solving the same problem, different algorithms can be designed. In these algorithms, number of steps, time and efforts may very more or less. Characteristics of a Good Algorithm Input : An algorithm must have 0 or well defined inputs. Output: An algorithm must have 1 or well defined outputs, and should match with the desired outputs. Feasibility: An algorithm must be terminated after the finite number of steps. Independent: An algorithm musts have step-by-step directions which is independent of any programming code. Uniqueness: The results of each step are uniquely by defined and only depended on the input and result of the proceeding step. Finiteness: Algorithms must terminate after a finite number of steps. Pseudo Code Pseudo code is a plain language description of a computer program intended to be understood by a human rather executed by a computer. Pseudo code eliminates boilerplate required by computer, such as variable declarations. It uses natural language instructions where convenient. Sometimes pseudo code can also involve mathematical notations, depending on the nature of the programs and the target demographic. Pseudo code is the textual, linear equivalent of flow charts. R.M.Reeza 01 Programming 17 Assignment Since the target audience for pseudo code is another person, there are no steadfast rules for syntax for semantic. Instead, pseudo code borrows heavily from the conventions and keywords of other languages, such as indentation for nesting. The resemblance with pseudo code is a USP for languages like HAGGIS. Python’s emphasis on readability makes valid code just as understandable as nature language. The basic rules before writing pseudo code Write only one statement per line. Write what you mean, not hoe to program it. Give proper indentation to show hierarchy and make code understandable. Make the program as simple as possible. Conditions and loops must be specified well i.e. begun and ended explicitly as in given pseudo code examples. Advantages of pseudo code It allows the designer to focus on main logic without being distracted by programming languages syntax Since it is language independent, it can be translated to any computer language code. It allows designer to express logic in pain natural language. It is easier to write actual code using pseudo code. Unlike algorithms, pseudo code are concise so pseudo codes are more readable and easier to modify. Start R.M.Reeza 01 Programming 18 Assignment Input num1, num2, num3 Sum= num1+num2+num3 Print tot End Flow Chart Flowchart is a graphical representation of an algorithm. Programmers often use it as a program-planning tool to solve a problem. It makes use of symbols, which are connected among them to indicate the flow of information and processing. The process of drawing a flowchart for an algorithm is known as flowcharting. Start R.M.Reeza 01 Input num1 Input num2 Programming 19 Assignment Sum= num1+num2+num2 Print tot End A) Pseudo code (Fibonacci series) Start Define variables n /*fuvction*/ recur_Fibo= (n) If n<=1 than return n else R.M.Reeza 01 Programming 20 Assignment return (recur_fibo(n-1)+recur_fibo(n-2)) print (fibo(n)) end if end function /*main program*/ input n if num<=0 than display (“please enter a positive integer”) else display (“Fibonacci sequence”) for i in range (num) than display (recur_fibo(i) stop Dry run R.M.Reeza 01 Num n<=0 output 6 false 0,1,1,2,3,5 5 false 0,1,1,2,3 4 false 0,1,1,2 3 false 0,1,1,2 2 false 0,1,1 1 false 0,1 0 true enter a positive number Programming 21 Assignment Python coding Figure 1 Python Coding B) Pseudo code Factorial sequence Start Define variable n /*function*/ Function fact(n) If n=0 than return 1 else return=n*fact(n-1) end if R.M.Reeza 01 Programming 22 Assignment input num if num<0 than display(“enter the number”) else x=fact(num) display (“factorial of ” ,n,”is”,result) end if stop Dry Run Num 5 4 3 2 1 0 -5 R.M.Reeza 01 num n<=0 false false false false false false true Factorial(num) 5 4 3 2 1 0 Programming output 120 24 6 2 1 0 invalid number 23 Assignment Python coding Figure 2 Python Coding Big O notation Big O notation is mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. It is a member of a family of notations invented by Paul Bachmann, Edmund landau, and others, collectivity called Bachmann-Landau, and others, collectively called BachmannLandau notation or asymptotic notation Big O Notation is a way to measure how well a computer Algorithm scales as the amount of data involved increases. Simply Big O Notation is the language we use for talking about how long an algorithm takes to run. R.M.Reeza 01 Programming 24 Assignment Time takes to execute Space required in memory for the Algorithm Big O Notation does not consider the performance of hardware. It considers processor speed, Memory, storage space, and power. Big O Notation tells you the complexity of an algorithm in terms of the size of its inputs. This is essential if you want to know how long the algorithm will scale and also Big O Notation helps you to determine which Algorithms are fast, which are slow, and also Big O Notation analyzes how many operations a sorting Algorithm needs to complete to sort a very large collection of data. Example – If I needed my computer fixed and I know three computer operators who could do the job all within a reasonable price range and good service too. My next question would be how will it take? (The time duration). By using Big O Notation I can get the quickest method to get the job done R.M.Reeza 01 Programming 25 Assignment Activity 2 What is Programming Paradigm A programming paradigm is a way of thinking about and structuring a program’s functionality. Programming paradigms differ from one another, for example in how the program’s execution and control are defined and what components the programs consist of most programming languages that are currently in use support multiple programming paradigms. Part of a programmer’s growth involves the ability, thorough experience, to choose the appropriate programming language and paradigm; there currently is on single ubiquitous programming language and programming paradigm. The most common programming paradigms today are object-oriented programming, procedural programming, and functional programming. Procedural Programming Procedural programming uses a list of instructions to tell the computer what to do step-by step. Procedural programming relies on-you guessed it- procedures, also known as routines or subroutines. A procedure contain a series of computational steps to be carried out. Procedural programming is also referred to as imperative programming. Procedural programming languages are also known as top-down languages. Procedural programming is intuitive in the sense that it is very similar to how would expect a program to work. If you want a computer to do something, you should provide step-by –step instructions on how to do it. It is, therefore, no suprice that most of the early programming languages are all procedural. R.M.Reeza 01 Programming 26 Assignment Characteristics of procedural programming Procedural programming follows a top-down approach. Can use variables Can use functions Sequence selection The program is divided into blocks of codes called functions, where each function performs a specific task. Procedural programs model real world process as ‘procedures’ operating on ‘data’. The data and functions are detached from each other. The data moves freely in a program. It is easy to follow the logic of a program. R.M.Reeza 01 Programming 27 Assignment A function can access other function’s data by calling that function. Figure 3 Procedural Programming coding Object Oriented A programming languages structure wherein the data and their associated processing (“methods”) are define as self-contained entities called “objects” The norm today, object-oriented programming (OOP) languages, such as C++ and Java, provide a formal set of rules for creating and managing objects, the data are stored in a traditional relational database or in an object database or in an object database if the data have a complex structure. See O-R mapping and object database. There are three major features in object-oriented programming that makes them different than non-OOP languages encapsulation, inheritance and polymorphism R.M.Reeza 01 Programming 28 Assignment Characteristic of Object Oriented It follows a bottom-up approach Message passing Polymorphism Inheritance Dynamic Binding The program resulting from object-oriented programming is collection of objects. Each object has its own data and a set of operations. OOP restricts the free movement of data and the functions that operate on it. A properly defined class can be reused, giving way to code reusability. The concept of object-oriented programming models real-world entities very well. Due to its object-oriented approach, it is extremely useful involving complex problems. Figure 4 Object Oriented coding R.M.Reeza 01 Programming 29 Assignment Event-driven Paradigm Even driven programming known as a computer-programming paradigm that used the occurrence of events to determine the control flow of the program. This type of application is designed to detect events as they occur, and use an appropriate eventhandling procedure to deal with it, which normally use a callback function or method theoretically, event driven style of programming is supported in all programming languages, but they may different in the way of implement it, for example, it’s easier to Implement in languages that provide high-level abstractions, such as closures. Besides, for other programming environments such as adobe flash, they are specifically tailored for triggering program code by events. Generally, there is a main loop in an event-driven application that used to listen for events and triggers a callback function when are events is detected. Characteristics of Event-driven Service oriented Service oriented is key features in event driven programming that used to write programs that are made for service and it takes does not slow down the computer as service oriented only consume little of the computer processing power and usually services run in the background of OS Time Driven In event driven programming time driven is a paradigm, it’s a code runs on a time trigger, time driven can be a specific code that runs on a specific timed, which could be once an hour, once a week or once a month, this means it’s pre-set to do task. For example, windows update is the example of time driven, which users can set when to update or when to check and download the update. R.M.Reeza 01 Programming 30 Assignment Event Handlers Event handlers is a type of function or method that run a specific action when a specific event is trig ged. For example, it could be a button that when users click it , it will display a massage, and it will close the message when user click the button again, this is an event handler. Trigger Functions Trigger functions in event-driven programming are a functions that decide what code to run when there are a specific event occurs, which are used to select which event handler to use for the event when there is specific events occurred. Events Events include mouse, keyboard and user interface, which events need to be triggered in the program in order to happen, that mean user have to interface with an object in the program, for example, click a button by mouse, use keyboard to select a button and etc. Event object Time driven R.M.Reeza 01 Programming 31 Assignment Event listener Figure 5 Event driven coding Relationship between procedural, object-oriented and Event-driven programming In event-driven paradigms, one defines what will occur when a user executes an event. Can add event handlers to both procedural and object oriented paradigms Procedural paradigm is look at the process to solve a problem. Object oriented look at the actor and create objects to represent those actors. Event driven is used when have spontaneous moments that need to be taken care of In procedural paradigms, one defines a program and its subprograms as a series of steps R.M.Reeza 01 Programming 32 Assignment Activity 03 Rent Calculater RentCalculation(string VehicleNo, DateTime RentDate, DateTime ReturnDate, bool Driver ) NoDays= return_date - rent_date months = NoDays / 30 remainder = months % 30 weeks = remainder / 7 days = remainder % 7 /*Find the required vehicle record from vehicle table*/ if (found) then display monthRate, WeeklyRent, DailyRent and DriverRate amount= months * MonthlyRent = weeks * WeeklyRent + days * DailyRent if (WithDr == true) then Amount = amount + Nodays * DriverRate endif Display Amount else display "vehicle not found" endif end function R.M.Reeza 01 Programming 33 Assignment Day Tour-Hire Calculater DayTourCalculation(string VehicleNo, string PackageType, DateTime StartTime, DateTime EndTime, float StartKm, float EndKm, MaxKm, ExtraHrs, ExtraRate, ExtraHours_amt) Find the required Package record from Package table if (found) then dispaly MaxKm, MaxHrs, ExtraKmRate and ExtraHours_amt else display " There is no package found " endif NoOHrs = EndTime - StartTime if (NoOHours > MaxHrs) then ExraHrs = NoOHours - MaxHrs else ExraHrs = 0 endif ExtraHours_amt = ExraHrs * ExhrRate display ExtraHours_amt, NoOfHrs, ExtraHrs NoOKm = Endkm - Startkm if (NoOfkm > Maxkm) then ExtraKm = NoOkm - Maxkm ExtraKmChrg = ExtraKm * ExtraKmRate amount = Packagerate + ExtraHours_amt + ExtraKmChrg else ExtraKm = 0 R.M.Reeza 01 Programming 34 Assignment endif Display total amount end function Long Tour Calculater LongTourCalculation(string VehicleNo, string PackageType, DateTime StartDate, DateTime EndDate, float StartKm, float EndKm) Find the requried Package record from Package table if (found) then dispaly MaxKm ,ExtraKmRate, DriverOvernighCharge and NightParkingCharge else display "There is no package found" endif TotalDays = ReturnDate - RentDate display TotalDays NoOKm = Endkm - Startkm allocatKm = MaxKm * NoOfDays BaseHireCharge = PRate * NoODays OverNightCharge = (DriverOvernighCharge + NightParkingCharge)*(NoODays - 1) if (NoOkm > allocatedKm) then ExtraKm = NoOkm - allocatkm TotalcCost = BaseCharge BaseHireCharge + OverNightChrg + (ExtraKm * ExtraPerKmRate) R.M.Reeza 01 Programming 35 Assignment else ExtraKm = 0 endif Display TotalCost end function Integrated Development Environment (IDE) An integrated development environment is a software suite that consolidates basic tools required to write and test software and it is a collection of integrated programs to write, assemble, execute and depay program. Developers use numerous tools throughout software code creation, building and testing. Development tools often include text editors, code libraries, compilers and test platforms. Without an IDE, a developer must select, deploy, integrate and manage all of these tools separately. An IDE brings many of those development related tools together as a single framework, application or service The integrated toolset is designed to simplify software development and can identify and minimize coding mistakes and typos. Features of integrated development environment An IDE typically contains a code editor, a compiler or interpreter, and a debugger, accessed through a single graphical user interface. An IDE can also contain features such as programmable editors, object and data modelling, unit testing, a source code library and build automation tools. R.M.Reeza 01 Programming 36 Assignment An IDE can support model- driven development (MDD). A developer working with an IDE starts with a model, which the IDE translates in to suitable code. The IDE then debugs and tests the model – driven code, with a high level of automation. Once the build is successful and properly tested, it can be deployed for further testing through the IDE or other tools outside of the IDE. The use of the Visual Studio IDE for your application development Visual Studio is an Integrated Development Environment(IDE) developed by Microsoft to develop GUI(Graphical User Interface), console, Web applications, web apps, mobile apps, cloud, and web services, etc. With the help of this IDE, you can create managed code as well as native code. It uses the various platforms of Microsoft software development software like Windows store, Microsoft Silverlight, and Windows API, etc. It is not a language-specific IDE as you can use this to write code in C#, C++, VB(Visual Basic), Python, JavaScript, and many more languages. It provides support for 36 different programming languages. It is available for Windows as well as for macOS. R.M.Reeza 01 Programming 37 Assignment Activity 4 Main Menu Interface R.M.Reeza 01 Programming 38 Assignment Vehicle Hiring System Figure 6 System page 1 R.M.Reeza 01 Programming 39 Assignment Figure 7 System Page 2 Figure 8 System page 3 R.M.Reeza 01 Programming 40 Assignment What is Debugging? Debugging in computer programming and engineering is a multi-step process that involves identifying a problem, isolating the source of the problem, and then either correcting the problem or determining a way to work around it. The final step of debugging is to test the correction or workaround and make sure it works. In software development the debugging process begins when a developer locates a code error in a computer program and is able to reproduce it. Debugging is part of the software testing process and is an integral part of the entire software development lifecycle. In hardware development, the debugging process typically looks for hardware components that are not installed or configured correctly. Debugging Process Problem identification and report preparation Assigning the report to software engineer to the defect to verify that it is genuine. Defect analysis using modeling, documentations, finding and testing candidate flaws, etc Defect resolution by making required changes to the system. Validation of corrections. R.M.Reeza 01 Programming 41 Assignment Visual studio IDE for Debugging Unfortunately, writing code goes hand in hand with creating bugs, we all cause bugs, it’s one of the inevitable facts of life. This process of solving those bugs is called Debugging. Debugging comes in many forms stepping through the code with a debugger v, investigation logs, unit testing ,profiling, and analyzing dumps. As net developers, our main form of debugging is interactive debugging, with visual studio. Visual studio is not the only debugger at our disposal. But visual studio is the most widely used and the focus of this article. Visual studio might seem easy to start with, but it has a great many features that are crucial to effective debugging. Mastering visual studio debugging will decrease debugging time and turn you into a more effective developer. R.M.Reeza 01 Programming 42 Assignment FEATURES AVAILABLE IN VISUAL STUDIO IDE FOR DEBUGGING MY CODE Breakpoints It indicates where the running code should look at the values of variables, behavior of memory, or whether or not a branch of code is being run. and the Breakpoints are one of the most important debugging techniques in your developer's toolbox. You set breakpoints wherever you want to pause debugger execution. For example, you may want to see the state of code variables or look at the call stack at a certain breakpoint. Dump file It is a snapshot that shows the process was execute and modules that were loaded for a program at a point in time. Try-catch Its helps to identify the error when the program is not working. A try catch block is place around code that could throw an exception. R.M.Reeza 01 Programming 43 Assignment Evaluate how the debugging process can be used to help develop more secure, robust applications. Debugging is a process of reproducing, isolating, and characterizing “bugs” (defects) in a system. It is a mitigation after those defects have already been introduced! At best, we can use analysis of past debugging cycles to inform better engineering practices and perhaps as research towards developing better tooling to be used in the process of software design and engineering. However, security and resilience are features, which need to be part of the design, as well as implementation of software. Developing higher quality software entails using better quality assurance practices and enabling your QA to inform your engineering and management decisions and practices. Adopting test-driving or behavior driving methodology, and tools, which facilitate them, can be part of that approach. Use of agile or extreme processes can be another. None of these has anything to do with “debugging.” These are practices, which prevent the introductions of bugs. They are proactive rather than reactive. After debugging the best you can do a add regression tests to prevent that big from being re-introduced and analyze is cause to device more general test cases which might detect similar defects between introduction and any release process. (Automated regression testing can save QA time and resources be preventing defective builds from internal release to QA). Coding standards C# is about objects, classes, and class methods. The runtime handles memory management so you do not have to. Your C# code is compiled into an intermediate language and runs on the .NET platform. It’s a language built around productivity; therefore, the compiler does many optimizations so you can write clean, readable code. There are some general standards that fluent C# writers follow. R.M.Reeza 01 Programming 44 Assignment 1. Casing Naming is hard. And because it’s hard, we don’t want to confound the issue with mixed casing. Every language has its own casing standards. To add to the confusion, many organizations, or even teams, have their own standards. When there’s no standard in place, you might even see a cornucopia of every naming convention in just one page of code?I sure have! There are three casings generally accepted by C# standards: PascalCase: This is for class names, file names, namespace names, ALL method names, and public member names. camelCase: This is used for member names that are not publicly accessible. UPPER_CASE: You might also think of this as upper snake case. This is only used for constants. 2. Formatting We have formatting conventions for C#, just as we do in any programming language. Formatting has to do with line breaks, indentation, and spacing. True, the IDE will often help with formatting, but it does not do everything for you 3. “var” Is Your Friend Using?var is actually a good idea for all those short-lived variables. It not only saves a lot of redundancy, but it allows for more flexibility in the code. If you can already see the type based on the variable name, you’re good to go with var! Here are a few examples of var in practice: R.M.Reeza 01 Programming 45 Assignment 4. Always Use Access Modifiers Always use access modifiers! I know I know … the default is sometimes what you want: “private” for members, “internal” for classes. However, it really does help to be explicit about this. It shows that you were purposeful in your intent 5. Use Auto Properties An auto property creates a backing field for you; you just cannot see it or access it. If you do not need control over the backing field, do not create one. Instead, just use the auto property (the shortcut is “prop”). It will save a lot of extra code 6. Where to Declare Variables Declare variables as close as possible to their use. Some languages work better when you declare all your variables at the start of the function, but the C# compiler does not R.M.Reeza 01 Programming 46 Assignment care. It will do the optimal thing no matter where you put the variable. Put the variable close to its use so you have an easier time refactoring your code. In fact, your IDE allows you to highlight the section and right-click (or use Ctrl+.) to do some handy refactoring. If your variable is declared way up top, the refactoring will be overly complex or even downright impossible. 7. Code File Organization You should only put one class, interface, strict, or enum in a single file. This makes the codebase easier to navigate. For this same reason, you should keep your code organized in folders within the projects. A project is a collection of files that are related. The namespace should match the project name and the directory path it’s located in. For example, let’s say you have a project called Peoples and a Utilities directory (for, you know, utilities). A utility class to format names would look like this: 8. Use the Aliases, Jack! All of the primitive types have aliases. String has string. Int32 has int. Int64 has? Long. There are much more where those came from, and it is the preferred way to R.M.Reeza 01 Programming 47 Assignment refer to those types. Use them even if you are calling a method on the type such as int.Parse. 9. “Using” Is Your Friend! When you have a disposable type, there’s a great little construct built into the language: using. It calls Dispose when the program flow leaves the scope. Here’s an example: Code standard that I used in my application Used comments- Commenting make easy to understand the coding. proper variable- provide a way of labeling data with a descriptive name proper control names- names we can easily determine the coding. proper field names - field names helps to identify and understand easily. R.M.Reeza 01 Programming 48 Assignment Reference 1. Ukessays.com. 2021. Event-Driven Programming Features. [online] Available at: <https://www.ukessays.com/essays/computer-science/eventdrivenprogramming-features-6167.php> [Accessed 28 December 2021]. 2. GeeksforGeeks. 2021. Software Engineering | Debugging - GeeksforGeeks. [online] Available at: <https://www.geeksforgeeks.org/software-engineeringdebugging/> [Accessed 29 December 2021]. 3. Khan Academy. 2021. Big-O notation (article) | Algorithms | Khan Academy . [online] Available at: <https://www.khanacademy.org/computing/computerscience/algorithms/asymptotic-notation/a/big-o-notation> [Accessed 29 December 2021]. 4. Coursef.com. 2021. Characteristics Of Event Driven Programming - 12/2021. [online] Available at: <https://www.coursef.com/characteristics-of-eventdriven-programming> [Accessed 29 December 2021]. R.M.Reeza 01 Programming 49 Assignment Grading Rubric Grading Criteria Achieved Feedback LO1 Define basic algorithms to carry out an operation and outline the process of programming an application. P1Provide a definition of what an algorithm is and outline the process in building an application. M1Determine the steps taken from writing code to execution. D1 Evaluate the implementation of an algorithm in a suitable language. Evaluate the relationship between the written algorithm and the code variant 50 R.M.Reeza Programming Assignment 01 LO2 Explain the characteristics of procedural, objectorientated and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE) P2Give explanations of what procedural, objectorientated, and eventdriven paradigms are; their characteristics and the relationship between them. M2 Compare and contrast the procedural, object orientated and event driven paradigms used in given source code of an application D2Critically evaluate the source code of an application which implements the programming paradigms, in terms of the code structure and characteristics. LO3Implement basic algorithms in code using an IDE. 51 R.M.Reeza Programming Assignment 01 P3Write a program that implements an algorithm using an IDE. M3Use the IDE to manage the development process of the program. D3Evaluate the use of an IDE for development of applications contrasted with not using an IDE. LO4 Determine the debugging process and explain the importance of a coding standard P4Explain the debugging process and explain the debugging facilities available in the IDE. P5Outline the coding standard you have used in your code. 52 R.M.Reeza Programming Assignment 01 M4Evaluate how the debugging process can be used to help develop more secure, robust applications. D4 Critically evaluate why a coding standard is necessary in a team as well as for the individual. 53 R.M.Reeza Programming Assignment 01 54 R.M.Reeza Programming Assignment 01