Higher Nationals Internal verification of assessment decisions – BTEC (RQF) INTERNAL VERIFICATION – ASSESSMENT DECISIONS Programme title Assessor Unit(s) Assignment title Student’s name Pearson BTEC HND in Computing T.A.Rahuman Internal Verifier Unit 01: Programming Design & Implement a GUI based system using a suitable Integrated Development Environment R.A Minuka hansaja ranasinghe 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 been assessed accurately? Is the feedback to the student: Give details: • Constructive? • Linked to relevant assessment criteria? • Identifying opportunities for improved performance? • Agreeing actions? Does the assessment decision need amending? Y/N Y/N Y/N Y/N Y/N Y/N Y/N Y/N Assessor signature Date Internal Verifier signature Date Programme Leader signature (if required) Date Confirm action completed Remedial action taken Give details: Assessor signature Date Internal Verifier signature Date Programme Leader signature (if required) Date Higher Nationals - Summative Assignment Feedback Form Student Name/ID Unit Title Assignment Number Assessor Submission Date Date Received 1st submission Re-submission Date Date Received 2nd submission 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 suit 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 Formative Feedback: Assessor to Student Action Plan Summative feedback Feedback: Student to Assessor Assessor signature Date Student signature Date Pearson Higher Nationals in Computing Unit 01: Programming Assignment 01 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 be sure to fill the details correctly. 2. This entire brief should be attached in first before you start answering. 3. All the assignments should prepare using word processing software. 4. All the assignments should print in A4 sized paper, and make sure to only use one side printing. 5. Allow 1” margin on each side of the paper. But on the left side you will need to leave room for binging. Word Processing Rules 1. Use a font type that will make easy for your examiner to read. The font size should be 12 point, and should be in the style of Time New Roman. 2. Use 1.5 line word-processing. Left justify all paragraphs. 3. Ensure that all headings are consistent in terms of size and font style. 4. Use footer function on 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 edit your assignment. Important Points: 1. Check carefully the hand in date and the instructions given with the assignment. Late submissions will not be accepted. 2. Ensure that you give yourself enough time to complete the assignment by the due date. 3. Don’t leave things such as printing to the last minute – excuses of this nature will not be accepted for failure to hand in the work on time. 4. You must take responsibility for managing your own time effectively. 5. 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. 6. Failure to achieve at least a PASS grade will result in a REFERRAL grade being given. 7. Non-submission of work without valid reasons will lead to an automatic REFERRAL. You will then be asked to complete an alternative assignment. 8. Take great care that if you use other people’s work or ideas in your assignment, you properly reference them, using the HARVARD referencing system, in you text and any bibliography, otherwise you may be guilty of plagiarism. 9. If you are caught plagiarising you could have your grade reduced to A REFERRAL or at worst you could be excluded 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) Date: (Provide Submission Date) Higher National Diploma in Computing Assignment Brief Student Name /ID Number Unit Number and Title Unit 01: Programming Academic Year 2017/18 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. 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 Assignment Brief and Guidance: Activity 1 Searching on an array/list is to find a given element on the array and return whether it is found or not and return its position if found. Linear search and binary search are two popular searching algorithms on arrays. 1.1 Define what an algorithm is and outline the characteristics of a good algorithm. Develop algorithms for linear search and binary search using Pseudo code. 1.2 Describe the steps involved in the process of writing and executing a program. Take an array of 10 or more elements and dry run the above two algorithms. Show the outputs at the end of each iteration and the final output. 1.3 Define 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 Define what is meant by a Programming Paradigm. Explain the main characteristics of Procedural, Object oriented and Event-driven paradigms and the relationships among them. 2.2 Write small snippets of code as example for the above three programming paradigms using a suitable programming language(s). 2.3 Critically evaluate the code samples that you have above in relation to their structure and the unique characteristics. Activity 3 and Activity 4 are based on the following Scenario. 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 type if that is applicable for that type of vehicle. For each package maximum km limit and maximum number of hours are also 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 3.1 Design suable algorithms for vehicle tariff calculation for rents and hires. Ideally 3 functions should be developed for this purpose as follows: 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. 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. 3.2 Implement the above algorithms using visual studio IDE (using C#.net) 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. 3.3 Analyze the features of an Integrated Development Environment (IDE) and explain how those features help in application development. Evaluate the use of the Visual Studio IDE 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 for Ayubo 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 What is debugging an application? Explain 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 Explain 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. Grading Rubric Grading Criteria LO1 Define basic algorithms to carry out an operation and outline the process of programming an application. P1 Provide a definition of what an algorithm is and outline the process in building an application. M1 Determine the steps taken from writing code to execution. D1 Examine the implementation of an algorithm in a suitable language. Evaluate the relationship between the written algorithm and the code variant Achieved Feedback LO2 Explain the characteristics of procedural, object orientated and event-driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE) P2 Give explanations of what procedural, object orientated, and event driven paradigms are; their characteristics and the relationship between them. M2 Analyze the common features that a developer has access to in an IDE. D2 Critically evaluate the source code of an application which implements the programming paradigms, in terms of the code structure and characteristics. LO3 Implement basic algorithms in code using an IDE. P3 Write a program that implements an algorithm using an IDE. M3 Use the IDE to manage the development process of the program. D3 Evaluate 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 P4 Explain the debugging process and explain the debugging facilities available in the IDE. P5 Outline the coding standard you have used in your code. M4 Evaluate 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. Table of Contents Process of Writing and Executing a Progra ......................................................................... 22 Big Notatio ............................................................................................................................... 28 Programming Paradig .............................................................................................................. 33 Programming Language ........................................................................................................... 45 Using Visual Studio ................................................................................................................. 59 Using an IDE in application development ............................................................................... 66 4.1 Debugging an application .................................................................................................. 67 4.2 Coding Standards .......................................................................................................... 69 Debugging Process ................................................................................................................... 70 What is an Algorithm? An algorithm is a step by step method of solving a problem. It is commonly used for data processing, calculation and other related computer and mathematical operations. An algorithm is also used to manipulate data in various ways, such as inserting a new data item, searching for a particular item or sorting an item. In computer programming, algorithms are often created as functions. These functions serve as small programs that can be referenced by a larger program. For example, an image viewing application may include a library of functions that each use a custom algorithm to render different image file formats. An image editing program may contain algorithms designed to process image data. Examples of image processing algorithms include cropping, resizing, sharpening, blurring, red-eye reduction, and color enhancement. In many cases, there are multiple ways to perform a specific operation within a software program. Therefore, programmers usually seek to create the most efficient algorithms possible. By using highly-efficient algorithms, developers can ensure their programs run as fast as possible and use minimal system resources. Of course, not all algorithms are created perfectly the first time. Therefore, developers often improve existing algorithms and include them in future software updates. When you see a new version of a software program that has been "optimized" or has "faster performance," it most means the new version includes more efficient algorithms. Also, we can think of a programming algorithm as a recipe that describes the exact steps needed for the computer to solve a problem or reach a goal.A programming algorithm describes how to do something, and your computer will do it exactly that way every time. Well, it will once you convert your algorithm into a language it understands! However, it's important to note that a programming algorithm is not computer code. It's written in simple English (or whatever the programmer speaks). It doesn't beat around the bush--it has a start, a middle, and an end. In fact, you will probably label the first step 'start' and the last step 'end.' It includes only what we need to carry out the task. It does not include anything unclear, often called ambiguous in computer lingo, that someone reading it might wonder about. It always leads to a solution and tries to be the most efficient solution we can think up. It's often a good idea to number the steps, but you don't have to. Instead of numbered steps, some folks use indentation and write in pseudo code, which is a semi-programming language used to describe the steps in an algorithm. . Characteristics of an Algorithm: Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning. Input − An algorithm should have 0 or more well-defined inputs. Output − An algorithm should have 1 or more well-defined outputs, and should match the desired output. Finiteness − Algorithms must terminate after a finite number of steps. Effectiveness- It is measured in terms of time and space. Feasibility- Should be feasible with the available recourses. Independent- An algorithm should have step-by-step direction, which should be independent of any programming code. Simple Example in Algorithm: Step 1: Start Step 2: Create a variable to receive the user’s email address Step 3:Clear the variable in cases it’s not empty Step 4: Ask the User for an Email address Step 5:Store the response in the variable Step 6: Cheack the Stored response to see it is a valid email address Step 7:Not valid? Go back To step Step8:End Linear search: In Linear Search the list is searched sequentially and the position is returned if the key element to be searched is available in the list, otherwise -1 is returned. The search in Linear Search starts at the beginning of an array and move to the end, testing for a match at each item. procedure linear_search (list, value) for each item in the list if match item == value return the item's location end if end for end procedure # Python Program for recursive binary search. # Returns index of x in arr if present, else -1 def binarySearch (arr, l, r, x): # Check base case if r >= l: mid = l + (r - l)/2 # If element is present at the middle itself if arr[mid] == x: return mid # If element is smaller than mid, then it # can only be present in left subarray elif arr[mid] > x: return binarySearch(arr, l, mid-1, x) # Else the element can only be present # in right subarray else: return binarySearch(arr, mid + 1, r, x) else: # Element is not present in the array return -1 # Test array arr = [ 2, 3, 4, 10, 40 ] x = 10 # Function call result = binarySearch(arr, 0, len(arr)-1, x) if result != -1: print "Element is present at index % d" % result else: print "Element is not present in array" Binary Search (Computer Hope) Binary search looks for a particular item by comparing the middle most item of the collection. If a match occurs, then the index of item is returned. If the middle item is greater than the item, then the item is searched in the sub-array to the left of the middle item. Otherwise, the item is searched for in the sub-array to the right of the middle item. This process continues on the sub-array as well until the size of the subarray reduces to zero. Process of Writing and Executing a Progra Programming Process Developing a program involves steps similar to any problem-solving task. There are six main ingredients in the programming process: 1. Defining the problem 2.Planing the solution 3.Coding the program 4.Testing the program 5.Documenting the program Defining the problem Suppose that, as a programmer, you are contacted because your services are needed. You meet with users from the client organization to analyze the problem, or you meet with a systems analyst who outlines the project. Specifically, the task of defining the problem consists of identifying what it is you know (input-given data), and what it is you want to obtain (output-the result). Eventually, you produce a written agreement that, among other things, specifies the kind of input, processing, and output required. This is not a simple process. Planning the solution Two common ways of planning the solution to a problem are to draw a flowchart and to write pseudocode, or possibly both. Essentially, a flowchart is a pictorial representation of a step-by-step solution to a problem. It consists of arrows representing the direction the program takes and boxes and other symbols representing actions. It is a map of what your program is going to do and how it is going to do it. The American National Standards Institute (ANSI) has developed a standard set of flowchart symbols. Figure 1 shows the symbols and how they might be used in a simple flowchart of a common everyday act-preparing a letter for mailing. Pseudocode is an English-like nonstandard language that lets you state your solution with more precision than you can in plain English but with less precision than is required when using a formal programming language. Pseudocode permits you to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language. However, pseudocode is not executable on the computer. We will illustrate these later in this chapter, when we focus on language examples. Coding the problem As the programmer, your next step is to code the program-that is, to express your solution in a programming language. You will translate the logic from the flowchart or pseudocode-or some other tool-to a programming language. As we have already noted, a programming language is a set of rules that provides a way of instructing the computer what operations to perform. There are many programming languages: BASIC, COBOL, Pascal, FORTRAN, and C are some examples. You may find yourself working with one or more of these. We will discuss the different types of languages in detail later in this chapter. Although programming languages operate grammatically, somewhat like the English language, they are much more precise. To get your program to work, you have to follow exactly the rules-the syntax-of the language you are using. Of course, using the language correctly is no guarantee that your program will work, any more than speaking grammatically correct English means you know what you are talking about. The point is that correct use of the language is the required first step. Then your coded program must be keyed, probably using a terminal or personal computer, in a form the computer can understand. One more note here: Programmers usually use a text editor, which is somewhat like a word processing program, to create a file that contains the program. However, as a beginner, you will probably want to write your program code on paper first. Testing the program Some experts insist that a well-designed program can be written correctly the first time. In fact, they assert that there are mathematical ways to prove that a program is correct. However, the imperfections of the world are still with us, so most programmers get used to the idea that their newly written programs probably have a few errors. This is a bit discouraging at first, since programmers tend to be precise, careful, detail-oriented people who take pride in their work. Still, there are many opportunities to introduce mistakes into programs, and you, just as those who have gone before you, will probably find several of them. Eventually, after coding the program, you must prepare to test it on the computer. This step involves these phases: 1. Desk-checking. This phase, similar to proofreading, is sometimes avoided by the programmer who is looking for a shortcut and is eager to run the program on the computer once it is written. However, with careful desk-checking you may discover several errors and possibly save yourself time in the long run. In desk-checking you simply sit down and mentally trace, or check, the logic of the program to attempt to ensure that it is error-free and workable. Many organizations take this phase a step further with a walkthrough, a process in which a group of programmers-your peersreview your program and offer suggestions in a collegial way. Translating. A translator is a program that (1) checks the syntax of your program to make sure the programming language was used correctly, giving you all the syntax-error messages, called diagnostics, and (2) then translates your program into a form the computer can understand. A by-product of the process is that the translator tells you if you have improperly used the programming language in some way. These types of mistakes are called syntax errors. The translator produces descriptive error messages. For instance, if in FORTRAN you mistakenly write N=2 *(I+J))-which has two closing parentheses instead of one-you will get a message that says, "UNMATCHED PARENTHESES." (Different translators may provide different wording for error messages.) Programs are most commonly translated by a compiler. A compiler translates your entire program at one time. The translation involves your original program, called a source module, which is transformed by a compiler into an object module. Prewritten programs from a system library may be added during the link/load phase, which results in a load module. The load module can then be executed by the computer. Debugging. A term used extensively in programming, debugging means detecting, locating, and correcting bugs (mistakes), usually by running the program. These bugs are logic errors, such as telling a computer to repeat an operation but not telling it how to stop repeating. In this phase you run the program using test data that you devise. You must plan the test data carefully to make sure you test every part of the program. Some experts insist that a well-designed program can be written correctly the first time. In fact, they assert that there are mathematical ways to prove that a program is correct. However, the imperfections of the world are still with us, so most programmers get used to the idea that their newly written programs probably have a few errors. This is a bit discouraging at first, since programmers tend to be precise, careful, detail-oriented people who take pride in their work. Still, there are many opportunities to introduce mistakes into programs, and you, just as those who have gone before you, will probably find several of them. Eventually, after coding the program, you must prepare to test it on the computer. This step involves these phases: Desk-checking. This phase, similar to proofreading, is sometimes avoided by the programmer who is looking for a shortcut and is eager to run the program on the computer once it is written. However, with careful desk-checking you may discover several errors and possibly save yourself time in the long run. In desk-checking you simply sit down and mentally trace, or check, the logic of the program to attempt to ensure that it is error-free and workable. Many organizations take this phase a step further with a walkthrough, a process in which a group of programmersyour peers-review your program and offer suggestions in a collegial way. Translating. A translator is a program that (1) checks the syntax of your program to make sure the programming language was used correctly, giving you all the syntax-error messages, called diagnostics, and (2) then translates your program into a form the computer can understand. A by-product of the process is that the translator tells you if you have improperly used the programming language in some way. These types of mistakes are called syntax errors. The translator produces descriptive error messages. For instance, if in FORTRAN you mistakenly write N=2 *(I+J))-which has two closing parentheses instead of one-you will get a message that says, "UNMATCHED PARENTHESES." (Different translators may provide different wording for error messages.) Programs are most commonly translated by a compiler. A compiler translates your entire program at one time. The translation involves your original program, called a source module, which is transformed by a compiler into an object module. Prewritten programs from a system library may be added during the link/load phase, which results in a load module. The load module can then be executed by the computer. Debugging. A term used extensively in programming, debugging means detecting, locating, and correcting bugs (mistakes), usually by running the program. These bugs are logic errors, such as telling a computer to repeat an operation but not telling it how to stop repeating. In this phase you run the program using test data that you devise. You must plan the test data carefully to make sure you test every part of the program. Documating the program Documenting is an ongoing, necessary process, although, as many programmers are, you may be eager to pursue more exciting computer-centered activities. Documentation is a written detailed description of the programming cycle and specific facts about the program. Typical program documentation materials include the origin and nature of the problem, a brief narrative description of the program, logic tools such as flowcharts and pseudocode, datarecord descriptions, program listings, and testing results. Comments in the program itself are also considered an essential part of documentation. Many programmers document as they code. In a broader sense, program documentation can be part of the documentation for an entire system. The wise programmer continues to document the program throughout its design, development, and testing. Documentation is needed to supplement human memory and to help organize program planning. Also, documentation is critical to communicate with others who have an interest in the program, especially other programmers who may be part of a programming team. And, since turnover is high in the computer industry, written documentation is needed so that those who come after you can make any necessary modifications in the program or track down any errors that you missed. Big Notatio Big-O notation is? Big O notation is used in Computer Science to describe the performance or complexity of an algorithm. Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. Anyone who's read Programming Pearls or any other Computer Science books and doesn’t have a grounding in Mathematics will have hit a wall when they reached chapters that mention O(N log N) or other seemingly crazy syntax. Hopefully this article will help you gain an understanding of the basics of Big O and Logarithms. As a programmer first and a mathematician second (or maybe third or fourth) I found the best way to understand Big O thoroughly was to produce some examples in code. So, below are some common orders of growth along with descriptions and examples where possible. describes an algorithm describes an algorithm that will always execute in the same time (or space) regardless of the size of the input data set. bool IsFirstElementNull(IList<string> elements) { return elements[0] == null; } O(N) O(N) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set. The example below also demonstrates how Big O favours the worst-case performance scenario; a matching string could be found during any iteration of the for loop and the function would return early, but Big O notation will always assume the upper limit where the algorithm will perform the maximum number of iterations. bool ContainsValue(IList<string> elements, string value) { foreach (var element in elements) { if (element == value) return true; } return false; } O(N2) O(N2) represents an algorithm whose performance is directly proportional to the square of the size of the input data set. This is common with algorithms that involve nested iterations over the data set. Deeper nested iterations will result in O(N3), O(N4) etc. bool ContainsDuplicates(IList<string> elements) { for (var outer = 0; outer < elements.Count; outer++) { for (var inner = 0; inner < elements.Count; inner++) { // Don't compare with self if (outer == inner) continue; if (elements[outer] == elements[inner]) return true; } } return false; } O(2N) O(2N) denotes an algorithm whose growth doubles with each additon to the input data set. The growth curve of an O(2N) function is exponential - starting off very shallow, then rising meteorically. An example of an O(2N) function is the recursive calculation of Fibonacci numbers: int Fibonacci(int number) { if (number <= 1) return number; return Fibonacci(number - 2) + Fibonacci(number - 1); } 1.3.2. Logarithms Logarithms are slightly trickier to explain so I'll use a common example: Binary search is a technique used to search sorted data sets. It works by selecting the middle element of the data set, essentially the median, and compares it against a target value. If the values match it will return success. If the target value is higher than the value of the probe element it will take the upper half of the data set and perform the same operation against it. Likewise, if the target value is lower than the value of the probe element it will perform the operation against the lower half. It will continue to halve the data set with each iteration until the value has been found or until it can no longer split the data set. This type of algorithm is described as O(log N). The iterative halving of data sets described in the binary search example produces a growth curve that peaks at the beginning and slowly flattens out as the size of the data sets increase e.g. an input data set containing 10 items takes one second to complete, a data set containing 100 items takes two seconds, and a data set containing 1000 items will take three seconds. Doubling the size of the input data set has little effect on its growth as after a single iteration of the algorithm the data set will be halved and therefore on a par with an input data set half the size. This makes algorithms like binary search extremely efficient when dealing with large data sets. Programming Paradigm Programming Paradigm A programming paradigm is a model of programming based on distinct concepts that shapes the way programmers design, organize and write programs. A multiparadigm programming language allows programmers to choose a specific single approach or mix parts of different programming paradigms. C++ as a multi-paradigm programming language supports single or mixed approaches using Procedural or Object-oriented programming and mixing in utilization of Generic and even Functional programming concepts. Main characteristics of Procedural, Object oriented and Even-driven paradigms and Relationship of Procedural, Object oriented and Even-driven paradigms Object Oriented Paradigms The Object oriented programming is one of the newest and most powerful paradigms. The Object-Oriented Programming mentions to the programming methodology based on the objects, in its place of just procedures and functions. These objects are planned into classes, which are allowing to the individual objects to be group together. Modern programming languages containing java, PHP and C or C++ are object-oriented languages The "object" in an Object Oriented Programing language discusses to a instance or specific type, of the class. Each and every object has a structure related to other objects in the class, but it can be allocated individual features. An object can also call as method or functions, particular to that object. The Individual characters are may be defined as objects, according to the object which are allows them to have different skill, appearances, and abilities. The Object oriented programming makes it easier to the programmers to design and organize software programs. The important features which are help to design the object-oriented programming and design is given below: ' Development over the designed programming paradigm. ' Importance on data rather than algorithms. ' Procedural abstraction is perfected by data abstraction. ' Data and associated processes are unified, grouping objects with common attributes, operations, and semantics The Principles of OOP According to the principals there twelve fundamental features there are given below. 1. Encapsulation 2. Data Abstraction 3. Inheritance 4. Polymorphism 5. Extensibility 6. Persistence 7. Delegation 8. Generality 9. Object Concurrency 10. Event Handling 11. Multiple Inheritance 12. Message Passing According to the Object Oriented programming language, it has to allow working with classes and objects as well as the implementation and use of the main four fundamental object oriented principles and concepts. 1. Encapsulation -Hide unnecessary details in classes and deliver a simple and clear interface for working. 2. Inheritance - explain how the class hierarchies develop code readability and support to the reuse of functionality. 3. Data Abstraction - to deal with objects since their important features and ignore all other details. 4. Polymorphism - explain how to work with different object in the same manner, which explain the specific implementation of some abstract behavior. Even-driven paradigms Event-driven programming is a programming paradigm in which the flow of program execution is determined by events - for example a user action such as a mouse click, key press, or a message from the operating system or another program. An event-driven application is designed to detect events as they occur, and then deal with them using an appropriate event-handling procedure. The idea is an extension of interrupt-driven programming of the kind found in early command-line environments such as DOS, and in embedded systems (where the application is implemented as firmware). Event-driven programs can be written in any programming language, although some languages(Visual Basic for example) are specifically designed to facilitate event-driven programming, and provide an integrated development environment (IDE) that partially automates the production of code, and provides a comprehensive selection of built-in objects and controls, each of which can respond to a range of events. Virtually all object-oriented and visual languages support eventdriven programming. Visual Basic, Visual C++ and Java are examples of such languages. A visual programming IDE such as VB.Net provides much of the code for detecting events automatically when a new application is created. The programmer can therefore concentrate on issues such as interface design, which involves adding controls such as command buttons, text boxes, and labels to standard forms (a form represents an application's workspace or window). Once the user interface is substantially complete, the programmer can add event-handling code to each control as required. Many visual programming environments will even provide code templates for event-handlers, so the programmer only needs to provide the code that defines the action the program should take when the event occurs. Each event-handler is usually bound to a specific object or control on a form. Any additional subroutines, methods, or function procedures required are usually placed in a separate code module, and can be called from other parts of the program as and when needed. 2.1.2.4. Procedural Paradigms Procedural programming is the standard approach used in traditional computer language such as C, Pascal, FORTRAN & BASIC. The basic idea is to have a program specify the sequence of steps that implements a particular algorithm . Procedural programming is a term used to denote the way in which a computer programmer writes a program. This method of developing software, which also is called an application, revolves around keeping code as concise as possible. It also focuses on a very specific end result to be achieved. Procedural programming creates a step by step program that guides the application through a sequence of instructions. Each instruction is executed in order. Procedural programming focuses on processes. In procedural programming data and functions are stored in separate memory location, while in OOP data and functions are stored in same memory location. Programs are made up of modules, which are parts of a program that can be coded and tested separately, and then assembled to form a complete program. In procedural languages (i.e. C) these modules are procedures, where a procedure is a sequence of statements. In C for example, procedures are a sequence of imperative statements, such as assignments, tests, loops and invocations of sub procedures. These procedures are functions, which map arguments to return statements. The design method used in procedural programming in called The Down Design This is where you start with a problem (procedure) and then systematically break the problem down into sub problems (sub procedures). This is called functional decomposition, which continues until a sub problem is straightforward enough to be solved by the corresponding sub procedure. When changes are made to the main procedure (top), those changes can casade to the sub procedures of main, and the sub-sub procedures and so on, where the change may impact all procedures in the pyramid. The problem with PP approach is its handing of data. PP approach gives no importance to data. By ‘data’ we mean the information collected from user, the new results obtained after calculations etc. Advantages of Procedural Programming: 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. Disadvantages of Procedural Programming: Difficult to relate with real world objects. Difficult to create new data types reduces extensibility. Importance is given to the operation on data rather than the data. Integrated Development Environment (IDE) IDE Features The Integrated Development Environment (IDE), as its name says, integrates legacy disparate tools - DDBuilder, ResBuilder, and GUIBuilder with their IDE counterparts - Data Dictionary, FormBuilder, and AppBuilder modules. The IDE in BBj version 2.0 and higher is based on the NetBeans IDE, a freely available and extensible open source software development environment written in Java. NetBeans is designed to accept plug-in modules that provide new capabilities or change its appearance and operation. The BASIS IDE is a collection of modules designed to equip the NetBeans IDE with tools for developing applications with any BBx interpreter - PRO/5, Visual PRO/5, or BBj. All of the Java software development capabilities are retained, making it possible to work with BBx and Java projects simultaneously. The NetBeans IDE contains a built-in help system (see Help on the main menu), which documents the basic operation of the IDE relating to Java software development. Therefore, only Business BASIC-specific features of the IDE will be covered here. It is important to note that while it is possible to download the NetBeans IDE directly from the NetBeans website rather than using the version provided with BBj, it will not be possible to configure it as the BASIS IDE. The Business BASIC-specific modules are designed for NetBeans version 3.6 and will not successfully operate with earlier or later versions, nor are the modules available as a separate install. The Explorer The Explorer Filesystems tab presents a hierarchical view of directories and files that have been mounted for use in NetBeans. Files that are used by BBC or one of their accessory programs, such as AppBuilder, are identified by unique icons to the left of the name. Clicking on one of these files with the left mouse button selects it while clicking with the right mouse button opens a popup menu displaying the operations available for that file. The Source Editor The Source Editor is a modern programmer's text editor that is optimized for writing Business BASIC source code. BBx program files in either text or tokenized format can be opened and edited. The Source Editor provides color syntax highlighting and sophisticated editing features such as advanced text find and replace, keyboard macros, word matching, abbreviation expansion, and quick navigation with bookmarks or Go To line number. Automatic popup code completion simplifies the use of BBj Object Syntax . Breakpoints can be set and saved from the Source Editor for convenience in later debugging sessions. The Source Editor is not connected with a BBj interpreter session and therefore does not require BBjServices to be running when it is used. It is the tool of choice when writing new code or making extensive changes to existing source files. When BBC source code is compiled, any resulting errors are displayed in the Source Editor via hyperlinks from the Compiler Output Window. The Debugger The Debugger incorporates BBj debugging and editing tools into the NetBeans environment, adding the ability to work with multiple files and manage projects. The Debugger features color syntax highlighting and code completion like the Source Editor, although other advanced code editing features may not be available. Unlike the Source Editor, the Debugger is always connected to a BBj interpreter and performs automatic syntax error checking as the code is modified. Programs can be executed in the Debugger via command line dot-stepping. Breakpoints can be inserted to control the flow, and variables can be monitored in the Watch Tab. The Debugger is the tool of choice for testing application code and making minor editing corrections. The Compiler The IDE allows the compiling of Business BASIC source code into three different token formats. If a development system has PRO/5 installed along with BBj, tokenized program files can be created in any of these formats. Text files and directories of files to be compiled are selected in the NetBeans Explorer. Choosing Compile/Compile All or Build/Build All from the menu feeds all the selected files or directories to the compiler of the desired token format. Any resulting errors are displayed as hyperlinks in the NetBeans Compiler Output Window. Double-clicking on an error hyperlink causes the original text source file to be automatically opened in the Source Editor, where the line containing the error is highlighted. .The Data File Viewer The Data File Viewer provides a convenient way to view the contents of database files. Like the character-based _browse utility, it does not allow creation or editing of data files but instead displays their contents in hexadecimal and ASCII. The Data File Viewer uses the BBj Filesystem Server to open and parse database files, which means that BBjServices must be running in order to use it. . .The Data Dictionary The IDE's Data Dictionary plug-in module provides the ability to view and maintain BASIS data dictionaries in the same environment used for developing applications. Like the previous tool, DDBuilder, the Data Dictionary module provides access to dictionaries located on the local machine (or accessible via mapped drives or UNIX mounts) as well as dictionaries accessible through PRO/5 Data Servers. However, unlike DDBuilder, the Data Dictionary has access to remote BBj databases and is available on all supported UNIX platforms with GUI support. . The FormBuilder The FormBuilder plug-in module replaces the MS Windows-only ResBuilder utility and is used to create graphical user interfaces for BBj programs. Graphical controls are arranged on a "form" just as they will appear in the application program. FormBuilder saves the resulting interface to an ASCII resource file with the extension .arc, which BBj uses to create the actual GUI interface at runtime. IDE Features Help to Application Development IDE Features mainly help for Application Development (Android) 1.Remote Procedure Call (RPC) Adapter Services: This feature will convert existing services made by Enterprise JavaBeans or Plain Old Java Objects (POJO) to RESTful services, which communicate using JSON, XML or other languages asynchronously. This leads to reuse of your existing assets to services for mobile. 2.Model-driven REST service development: You may not have any experience with REST development, but you may have a lot of experience with a design using Unified Modeling Language (UML). By applying the REST profiles and stereotype offered by Rational Software Architect to UML models, and then running UML-to-Java transformation, you will get the Java API for RESTful Web Services (JAX-RS) template code quickly. 3.WYSIWYG UI development (what you see is what you get): Since Rational Application Developer supports famous JavaScript libraries such as JQuery Mobile and Dojo Mobile, you can start writing UI codes to JQuery or Dojo templates (for example, layout including header, footer and some icon buttons like a native mobile application). And then you can easily put UI parts onto the layout using drag and drop. 4.Cordova support: Cordova is a platform for launching native APIs from JavaScript APIs. If you develop a mobile application using Cordova, you must know a series of commands— for example, Cordova creates, platform adds, the plugin adds, prepare, emulate and so on. Rational Application Developer makes these operations easier using GUI operations. Programming Language This software program is coded using C# it use two dynamic paradigm it are functional and Object-Oriented using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using VehicleRentalManagment.Classes; using System.Data.SqlClient; namespace pasindu.umeish_madranga { public partial class frmVehicle : Form { // Defining Sql Connection String SqlConnection conn = new SqlConnection(@"Data Source=HPEITEBOOK\SQLEXPRESS;Initial Catalog=STUDENT;Integrated Security=True"); int count=1; public Form1(); { InitializeComponent(); fill_vtypecmb(); } private void frmVehicle_Load(object sender, EventArgs e) { } private void checkBtn_Click(object sender, EventArgs e) { //Assigning values from Datepickers DateTime startDate = rentDatePicker.Value; DateTime endDate = returnDatePicker.Value; int startKm = int.Parse(startKmTbx.Text); int endKm = int.Parse(endKmTbx.Text); string vtype = vtypeCmb.SelectedValue.ToString(); double basecharge = 0.0, extraKmCharge = 0.0, waitingCharge = 0.0, overnightCharge = 0.0; BuisnessLogic Bl = new BuisnessLogic(); if (rentBtn.Checked) { basecharge = Bl.rentCalc(vtype, startDate, endDate, false); } else if (rentDriverBtn.Checked) { basecharge = Bl.rentCalc(vtype, startDate, endDate, true); } else if (dayHireBtn.Checked) { string pcode = packageCmb.SelectedValue.ToString(); Bl.dayHireCalc(vtype, pcode, startDate, endDate, startKm, endKm, ref basecharge, ref extraKmCharge, ref waitingCharge); } else if (longHirBtn.Checked) { string pcode = packageCmb.SelectedValue.ToString(); Bl.longHireCalc(vtype, pcode, startDate, endDate, startKm, endKm, ref basecharge, ref extraKmCharge, ref overnightCharge); } else MessageBox.Show("Selected Rent Type", "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); baseChargeTbx.Text = String.Format("{0:00}", basecharge); extraKmChargeTbx.Text = String.Format("{0:00}", extraKmCharge); waitingChargeTbx.Text = String.Format("{0:00}", waitingCharge); overnightChargeTbx.Text = String.Format("{0:00}", overnightCharge); double totCharge = basecharge + extraKmCharge overnightCharge; totalChargeTbx.Text = String.Format("{0:.00}", totCharge); } private void clearBtn_Click(object sender, EventArgs e) { form_clear(); + waitingCharge + } private void form_clear() { vtypeCmb.ResetText(); rentDatePicker.ResetText(); returnDatePicker.ResetText(); packageCmb.Text =""; startKmTbx.Text =""; endKmTbx.Text = ""; baseChargeTbx.Text =""; extraKmChargeTbx.Text =""; waitingChargeTbx.Text = ""; overnightChargeTbx.Text = ""; totalChargeTbx.Text = ""; cNameTbx.Text = ""; vehicleGridView.DataSource = null; vnoTbx.Text = ""; vmodelTbx.Text = ""; rentBtn.Checked = false; rentDriverBtn.Checked = false; longHirBtn.Checked = false; dayHireBtn.Checked = false; } private void saveBtn_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand("SELECT MAX(S_id) FROM Sales_Tbl", cnn); cnn.Open(); SqlDataReader dr = cmd.ExecuteReader(); int S_id=1; if (dr.Read()) if (!dr.IsDBNull(0)) S_id = int.Parse(dr[0].ToString()) + 1; cnn.Close(); string S_V_rengo = vnoTbx.Text; string S_type; if (rentBtn.Checked || rentDriverBtn.Checked) S_type = "Rent"; else S_type = "Hire"; String S_CustName = cNameTbx.Text; DateTime S_startDateTime = rentDatePicker.Value; DateTime S_endDateTime = returnDatePicker.Value; int S_startKmReading = int.Parse(startKmTbx.Text); int S_endKmReading = int.Parse(endKmTbx.Text); double S_baseCharge = double.Parse(baseChargeTbx.Text); double S_extraKmCharge = double.Parse(extraKmChargeTbx.Text); double S_waitingCharge = double.Parse(waitingChargeTbx.Text); double S_overnightCharge = double.Parse(overnightChargeTbx.Text); double S_totalCharge = double.Parse(totalChargeTbx.Text); string S_paid = "No"; cmd = new SqlCommand("INSERT INTO Sales_Tbl Values (@001,@002,@003,@004,@005,@006,@007,@008,@009,@010,@011,@012,@013,@01 4)", cnn); cmd.Parameters.AddWithValue("@001",S_id); cmd.Parameters.AddWithValue("@002",S_V_rengo); cmd.Parameters.AddWithValue("@003", S_type); cmd.Parameters.AddWithValue("@004",S_CustName); cmd.Parameters.AddWithValue("@005",S_startDateTime); cmd.Parameters.AddWithValue("@006",S_endDateTime); cmd.Parameters.AddWithValue("@007",S_startKmReading); cmd.Parameters.AddWithValue("@008",S_endKmReading); cmd.Parameters.AddWithValue("@009",S_baseCharge); cmd.Parameters.AddWithValue("@010",S_endKmReading); cmd.Parameters.AddWithValue("@011",S_waitingCharge); cmd.Parameters.AddWithValue("@012",S_overnightCharge); cmd.Parameters.AddWithValue("@013",S_totalCharge); cmd.Parameters.AddWithValue("@014",S_paid); form_clear(); cnn.Open(); cmd.ExecuteNonQuery(); cnn.Close(); } private void vtypeCmb_SelectedIndexChanged(object sender, EventArgs e) { if (count++ == 1) return; refreshGridView(); } private void refreshGridView() { vehicleGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; vehicleGridView.MultiSelect = false; SqlCommand cmd = new SqlCommand("SELECT V_regno,V_make,V_model FROM Vehicle_Tbl WHERE V_VT_code=@001", cnn); cmd.Parameters.AddWithValue("@001", vtypeCmb.SelectedValue); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); vehicleGridView.DataSource = dt; showVehicleSelected(); fill_packageCmb(); } private void showVehicleSelected() { int selectdRow = vehicleGridView.CurrentCell.RowIndex; vnoTbx.Text = vehicleGridView.Rows[selectdRow].Cells[0].Value.ToString(); string vmake = vehicleGridView.Rows[selectdRow].Cells[1].Value.ToString(); string vmodel = vehicleGridView.Rows[selectdRow].Cells[2].Value.ToString(); vmodelTbx.Text = vmake + "," + vmodel; } private void fill_packageCmb() { SqlCommand cmd = new SqlCommand("SELECT P_desc, P_code FROM HireTariff_Tbl, Package_Tbl WHERE HT_P_Code = P_Code AND HT_VT_code=@001", cnn); cmd.Parameters.AddWithValue("@001", vtypeCmb.SelectedValue); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count != 0) { packageCmb.DataSource = dt; packageCmb.DisplayMember = "P_desc"; packageCmb.ValueMember = "P_code"; ; } else { packageCmb.DataSource = null; packageCmb.Text = "No Packages"; } } private void fill_vtypecmb() { SqlDataAdapter da = new SqlDataAdapter("SELECT VT_code, VT_desc FROM VehicleType_Tbl", cnn); DataTable dt = new DataTable(); da.Fill(dt); vtypeCmb.DataSource = dt; vtypeCmb.DisplayMember = "VT_desc"; vtypeCmb.ValueMember = "VT_code"; } private void vehicleGridView_CellContentClick(object DataGridViewCellEventArgs e) { } private void vehicleGridView_SelectionChanged(object sender, EventArgs e) { showVehicleSelected(); } private void rentBtn_CheckedChanged(object sender, EventArgs e) { dataLabel1.Text = "Rented Date"; dataLabel2.Text = "Returned date"; rentDatePicker.Format = DateTimePickerFormat.Short; returnDatePicker.Format = DateTimePickerFormat.Short; rentDatePicker.ShowUpDown = false; returnDatePicker.ShowUpDown = false; } sender, private void rentDriverBtn_CheckedChanged(object sender, EventArgs e) { dataLabel1.Text = "Rented Date"; dataLabel2.Text = "Returned date"; rentDatePicker.Format = DateTimePickerFormat.Short; returnDatePicker.Format = DateTimePickerFormat.Short; rentDatePicker.ShowUpDown = false; returnDatePicker.ShowUpDown = false; } private void dayHireBtn_CheckedChanged(object sender, EventArgs e) { dataLabel1.Text = "Rented Date"; dataLabel2.Text = "Returned date"; rentDatePicker.Format = DateTimePickerFormat.Short; returnDatePicker.Format = DateTimePickerFormat.Short; rentDatePicker.ShowUpDown = true; returnDatePicker.ShowUpDown = true; } private void longHirBtn_CheckedChanged(object sender, EventArgs e) { dataLabel1.Text = "Rented Date"; dataLabel2.Text = "Returned date"; rentDatePicker.Format = DateTimePickerFormat.Short; returnDatePicker.Format = DateTimePickerFormat.Short; rentDatePicker.ShowUpDown = false; returnDatePicker.ShowUpDown = false; } } } Design suable algorithms //declared to day rent variable double dayRent = double.Parse(dr["VT_dayRent"].ToString()); //declared week rent variable double weekRent = double.Parse(dr["VT_weekRent"].ToString()); //declared day month variable double monthRent = double.Parse(dr["VT_monthRent"].ToString()); //declaredcost for driver in day variable double dayDriverCost = double.Parse(dr["VT_dayDriverCost"].ToString()); //declared time span for get date between given dates TimeSpan ts = endDate.Date - startDate.Date; //declared total days int totDays = ts.Days + 1; //declared reminding days int remDays = totDays; //making formula to get month by given time span int monthCount = (int)remDays / 30; //making formula to get reminding month days remDays = remDays % 30; //declaring week count by given formula int weekCount = (int)remDays / 7; //declared reminding days remDays = remDays % 7; //declared rent formula rent = monthCount * monthRent + weekCount * weekRent + remDays * dayRent; //declared condition to calculate day rent if (withDriver) //calculating rent rent = rent + totDays * dayDriverCost; } 3.1.2.Day Tour-Hire Calculation { int maxKms = int.Parse(dr["P_maxKms"].ToString()); int maxHours = int.Parse(dr["P_maxHours"].ToString()); baseCharge = double.Parse(dr["HT_baseCharge"].ToString()); double extraKmCost = double.Parse(dr["HT_extraKmCost"].ToString()); double extraHourCost = double.Parse(dr["HT_extraHourCost"].ToString()); TimeSpan ts = endTime - startTime; int totHours = ts.Hours; int totKms = endKm - startKm; if (totHours > maxHours) waitingCharge = (totHours - maxHours) * extraHourCost; if (totKms > maxKms) extraKmCharge = (totKms - maxKms) * extraKmCost; } 3.1.3.Long Tour-Hire Calculation { int maxKms = int.Parse(dr["P_maxKms"].ToString()); baseCharge = double.Parse(dr["HT_baseCharge"].ToString()); double extraKmCost = double.Parse(dr["HT_extraKmCost"].ToString()); double driverNightCost = double.Parse(dr["HT_driverNightCost"].ToString()); double vehicleNightCost double.Parse(dr["HT_vehicleNightCost"].ToString()); TimeSpan ts = endDate - stratDate; int totDays = ts.Days + 1; baseCharge = baseCharge * totDays; overninghStayCharge = (driverNightCost + vehicleNightCost) * (totDays - 1); = int runKms = endKm - startKm; int permitedKms = maxKms * totDays; if (runKms > permitedKms) extraKmCharge = (runKms - permitedKms) * extraKmCost; } Using Visual Studio Database management systems (DBMSs) are specially designed applications that interact with the user, other applications, and the database itself to capture and analyze data. A general-purpose database management system (DBMS) is a software system designed to allow the definition, creation, querying, update, and administration of databases. Well-known DBMSs include MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Microsoft Access, Oracle, Sybase, dBASE, FoxPro, and IBM DB2. A database is not generally portable across different DBMS, but different DBMSs can inter-operate by using standards such as SQL and ODBC or JDBC to allow a single application to work with more than one database. Database created using SQL Server Database Connected to Visual Studio v Table to keep sport detail Table to keep student detail Table to keep library detail Using an IDE in application development What is IDE? An integrated development environment (IDE) is a software suite that consolidates the basic tools developers need to write and test software. Typically, an IDE contains a code editor, a compiler or interpreter and a debugger that the developer accesses through a single graphical user interface (GUI). An IDE may be a standalone application and it may be included as part of one or more existing and compatible applications. Sometimes a version control system, or various tools to simplify the construction of a graphical user interface (GUI), are integrated. Many modern IDEs also have a class browser, an object browser, and a class hierarchy diagram, for use in object-oriented software development. Simply an IDE provides comprehensive facilities to computer programmers for software development. Most modern IDEs have intelligent code completion as well. IDEs are simply programs to write programs. They are generally editing environments with tools to help programmers write code quickly and efficiently. As an example, we can create PHP-driven web applications using a combination of Eclipse and PHPEclipse. Core features typically include: • Code completion or code insight: The ability of an IDE to know a language’s keywords and function names is crucial. The IDE may use this knowledge to do such things as highlight typographic errors, suggest a list of available functions based on the appropriate situation, or offer a function’s definition from the official documentation. • Resource management: When creating applications, languages often rely on certain resources, like library or header files, to be at specific locations. IDEs should be able to manage these resources. An IDE should be aware of any required resources so that errors can be spotted at the development stage and not later, in the compile or build stage. • Debugging tools: In an IDE, you should be able to thoroughly test your application before release. The IDE may be able to give variable values at certain points, connect to different data repositories, or accept different run-time parameters. • Compile and build: For languages that require a compile or build stage, IDEs translate code from high-level languages to the object code of the targeted platform.Requirements for these features vary substantially from language to language. Thus, traditionally, an IDE specializes in one language or a set of similar languages. Some famous IDEs and their languages include JBuilder for Java; Metrowerks CodeWarrior suite for Java, C, and C++; and Microsoft’s Visual Studio for its Visual Basic and C# family of languages. What's IDE important is for my software? 1.Less time and effort: The entire purpose of an IDE is to make developing faster and easier. Its tools and features are supposed to help you organize resources, prevent mistakes, and provide shortcuts. 2. Enforce project or company standards: Simply by working in the same development environment, a group of programmers will adhere to a standard way of doing things. Standards can be further enforced if the IDE offers predefined templates, or if code libraries are shared between different team members/teams working on the same project. 3. Project management: This can be twofold. First, many IDEs have documentation tools that either automate the entry of developer comments or may actually force developers to write comments in different areas. Second, simply by having a visual presentation of resources, it should be a lot easier to know how an application is laid out as opposed to traversing the file system for arcane files in the file system. 4.1 Debugging an application 4.1.1.What is Debugging? Debugging, in computer programming and engineering, is a multistep 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. 4.1.2.The debugging process In software development, debugging involves locating and correcting code errors in a computer program. Debugging is part of the software testing process and is an integral part of the entire software development lifecycle. The debugging process starts as soon as code is written and continues in successive stages as code is combined with other units of programming to form a software product. In a large program that has thousands and thousands of lines of code, the debugging process can be made easier by using strategies such as unit tests, code reviews and pair programming. Once an error has been identified, it is necessary to actually find the error in the code. At this point, it can be useful to look at the code's logging and use a stand-alone debugger tool or the debugging component of an integrated development environment (IDE). Invariably, the bugs in the functions that get most use are found and fixed first. In some cases, the module that presents the problem is obvious, while the line of code itself is not. In that case, unit tests -such as JUnit and xUnit, which allow the programmer to run a specific function with specific inputs -- can be helpful in debugging. The standard practice is to set up a "breakpoint" and run the program until that breakpoint, at which time program execution stops. The debugging component of an IDE typically provides the programmer with the capability to view memory and see variables, run the program to the next breakpoint, execute just the next line of code, and, in some cases, change the value of variables or even change the contents of the line of code about to be executed. 4.1.3.Common debugging tools Source code analyzers, which include security, common code errors and complexity analyzers, can also be helpful in debugging. A complexity analyzer can find modules that are so intricate as to be hard to understand and test. Some tools can actually analyze a test run to see what lines of code were not executed, which can aid in debugging. Other debugging tools include advanced logging and simulators that allow the programmer to model how an app on a mobile device will display and behave. 4.2 Coding Standards 1. Code demarcation standard 2. PHP coding standard 3. PHP code sniffers 4. JavaScript coding standard 5. jQuery widget coding standard 6. DocBlock standard 7. JavaScript DocBlock standard 8. LESS coding standard 9. HTML style guide Useful Coding Standards It is a well-known fact that in any industry standardization positively impacts the business. Similarly, in the software industry, establishing coding standards is essential for successful implementation of a program. The smooth functioning of software programs is vital for the success of most organizations. Coding standards can be understood as a series of procedure for a specific programming language that determines the programming style, procedures, methods, for various aspects of the program written in that language. They are a very critical attribute of software development. A coding standard ensures that all developers writing the code in a particular language write according to the guidelines specified. This makes the code easy to understand and provides consistency in the code. One of the most essential factors in a software system is the consistency of the coding standard. This is because it positively impacts the quality of the system. While using a software system, you need to ensure that the guidelines do not contradict each other. The source code that uses the standard should also be in harmony with the standard. The completed source code should indicate as if the code has been written by a single developer in a single session. Debugging Process What is Debugging It is a systematic process of spotting and fixing the number of bugs, or defects, in a piece of software so that the software is behaving as expected. Debugging is harder for complex systems in particular when various subsystems are tightly coupled as changes in one system or interface may cause bugs to emerge in another. Debugging is a developer activity and effective debugging is very important before testing begins to increase the quality of the system. Debugging will not give confidence that the system meets its requirements completely but testing gives confidence. Identifying and removing errors from a program or software is called debugging. Debugging is ideally part of the testing process but in reality, it is done at every step of programming. Coders should debug the smallest of their modules before moving on. This decreases the number of errors thrown up during the testing phase and reduces testing time and effort significantly. types of errors that can crop up in a program. Syntax Errors Syntax errors are the grammatical errors in a program. Every language has its own set of rules, like creating identifiers, writing expressions, etc. for writing programs. When these rules are violated, the errors are called syntax errors. Many modern integrated development environments can identify the syntax errors as you type our program. Else, it will be shown when my compile the program. an example Code Optimization Any method by which code is modified to improve its quality and efficiency is called code optimization. Code quality determines the lifespan of code. If the code can be used and maintained for a long period of time, carried over from product to product, its quality is deemed to be high and it has a longer life. On the contrary, if a piece of code can be used and maintained only for short durations, say till a version is valid, it is deemed to be of low quality and has a short life. Reliability and speed of a code determine code efficiency. Code efficiency is an important factor in ensuring high performance of a software. There are two approaches to code optimization − Intuition based optimization (IBO) − Here the programmer tries to optimize the program based on her own skill and experience. This might work for small programs but fails miserably as the complexity of the program grows. Evidence-based optimization (EBO) − Here automated tools are used to find out performance bottlenecks and then relevant portions optimize accordingly. Every programming language has its own set of code optimization tools. For example, PMD, Find Bug, and Clover are used to optimize Java code. The code is optimized for execution time and memory consumption because time is scarce and memory expensive. There has to be a balance between the two. If time optimization increases the load on memory or memory optimization makes the code slower, the purpose of optimization will be lost. Using a debugger is usually a repetitive process. i write some code, run it, it doesn't work, so i debug it, fix something, run the debugger again, fix something, run the debugger again, etc. References Energy Code Analyzer[2014] http://www.enerjy.com/index.html studytonight.com, 2018. [Online] https://www.studytonight.com/data-structures/search-algorithms GNU Coding standard [2018] http://www.gnu.org/prep/standards/standards.html onlineclassnotes.com, [Online] http://www.onlineclassnotes.com/2013/08/whqt-are-main-characteristics-of.html?m=1 ]. xlinux.nist.gov, [Online] https://xlinux.nist.gov/dads/HTML/bigOnotatiom.html interactivepython.org, [Online] http://interactivepython.org/runestone/static/pythonds/AlgorithmAnalysis/BigONotation.html tutorialspoint.com, [Online] https://www.tutorialspoint.com/data_structures_algorithms/linear_search_program_in_c.ht m https://www.tutorialspoint.com/data_structures_algorithms/binary_search_algorithm.htm https://www.tutorialspoint.com/data_structures_algorithms/binary_search_program_in_c.ht m