Assignment1 nguyebn va a

17 30 0
Assignment1 nguyebn va a

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Computers can connect to the network and communicate with one another through any medium. The three main types of networks for operating over the area they cover are LAN, MAN, and WAN. They have some things in common and things in common with one another. The geographic areas they cover, with LAN covering the smallest, MAN covering an area greater than LAN, and WAN covering the largest

ASSIGNMENT BRIEF Qualification BTEC Level HND Diploma in Computing Unit number and Title Unit 1: Programming Assignment title Problem solving with algorithms Academic Year Unit Tutor Issue date Submission date Submission Format: Format: The submission is in the form of an individual written report and a presentation 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 Submission Students are compulsory to submit the assignment in due date and in a way requested by the Tutors The form of submission will be a soft copy in PDF posted on corresponding course of http://cms.greenwich.edu.vn/ Note: The Assignment must be your own work, and not copied by or from another student or from books etc If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style Make sure that you know how to reference properly, and that understand the guidelines on plagiarism If you not, you definitely get fail Assignment Brief and Guidance: Scenario: You have applied for a post as a trainee with a software development company and have been invited for an interview You have been asked to demonstrate your problem solving and basic programming skills To this you have to prepare a report on using algorithms to solve problems You need to explain, using examples, how algorithms are used to solve simple business problems and the steps needed to be followed to produce a working program solution You should make clear your assumption about your program The problems to be solved will involve basic procedural programming instructions - sequence instructions (input, output and assignment statements), loops, conditional statements Problems should be analysed and designed by the use of flowchart and demonstrated by the use of modules (procedures) using a menu based program Tasks: Page State your simple business problems to be solved Analyse the problem and design the solutions by the use of suitable methods Demonstrate the compilation and running of a menu-based program Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language You also need to a presentation of your work (it should be summary of your report) Learning Outcomes and Assessment Criteria Pass Merit Distinction 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 Contents CHAPTER 1:Define basic algorithms to carry out an operation and outline the process of programming an application Provide a definition of what an algorithm is and outline the process in building an application (P1) 1.1 Definition of algorithm: .3 1.1.1 Examples of Algorithms in real life: .4 1.2 Ways to demonstrate algorithms 1.2.1 Using Flowchart .6 1.2.2 Examples: .6 1.2.3 Using Pseudocode: .8 1.2.4 Examples: .8 1.3 Characteristic of Algorithms: 1.3.1 Advantages and disadvantages of algorithms: 1.3.2 Steps to write a good algorithm: 1.4 Steps in program development: 13 1.4.1Example of steps in program development: .14 Page 2 Determine the steps taken from writing code to execute (M1) .15 2.1 The steps involved from writing code to executing the code depend on the programming language and development environment 15 CHAPTER 1:Define basic algorithms to carry out an operation and outline the process of programming an application Provide a definition of what an algorithm is and outline the process in building an application (P1) 1.1 Definition of algorithm:  An algorithm, also called an algorithm, is a finite set of well-defined instructions that can be executed by a computer, usually to solve a class of problems or to perform a calculation [1] ][2] Algorithms are always explicit and are used to specify the performance of calculations, data processing, automatic inference, and other tasks Page Figure Algorithms 1.1.1 Examples of Algorithms in real life:  Cook rice: Step 1: Determine the amount of rice and measure the rice accurately Step 2: Wash the rice with water Step 3: Soak rice for about 20 minutes Page Step 4: Measure the water suitable for the amount of rice Step 5: Cook Step 6: Incubate the rice for about to 10 minutes Page 1.2 Ways to demonstrate algorithms 1.2.1 Using Flowchart  Flowchart is a graphical means of visualizing a sequence of tasks for a simple visual configuration of steps, resulting change conditions , … Figure Flowchart 1.2.2 Examples: a) drawtoup-to- Page How-can-Ia-flowchartprint-evennumbers100 b) How can I draw a flowchart to print between to 20 even numbers? 1.2.3 Using Pseudocode:  Pseudocode is an informal way of describing programming that does not require any programming language syntax Pseudocode is simply developing an algorithm in the form of annotations and informative text in English Not belonging to any programming Page language, the syntax of pseudocode is not the same as that of a programming language Therefore, computers cannot interpret or interpret pseudocode Figure Pseudocode 1.2.4 Examples: a) Write a pseudocode to accept a student’s marks in Physics, Chemistry, and Biology The total of these marks as well as the average should be displayed Begin Input: Physic, Chemistry,Biology TB = (Physic + Chemistry + Biology)/3 Output TB End b) Calculate the sum of two numbers Begin Input: sohang1, sohang2 Tong = sohang1 + sohang2 Output: tong End 1.3 Characteristic of Algorithms:  Algorithms have several characteristics that define their nature and functionality Here are some key characteristics of algorithms: - Finiteness: A finite number of steps and a finite number of stages are required for an algorithm to be complete - Input: An algorithm may have many inputs or no inputs at all - Output: It should result at least one output - Definiteness: Each step must be clear, well-defined and precise There should be no any ambiguity - Well-defined steps: An algorithm consists of a finite set of well-defined steps that need to be executed in a specific order to achieve a desired result Each step should be precisely described, leaving no ambiguity - Language independence: Algorithms are independent of any specific programming language They can be implemented in different programming languages as long as the steps and operations are preserved - Analysis and optimization: Algorithms can be analyzed and optimized to improve their efficiency and performance Techniques such as time complexity analysis and algorithmic design paradigms help in evaluating and enhancing algorithms Page 1.3.1 Advantages and disadvantages of algorithms:  Advantages of Algorithms: - It helps to break down a big problem into smaller manageable steps of the solution - an algorithm that is reproducible with the same input and condition will always produce an output for testing and debugging - Algorithms enable automation by providing step-by-step instructions that can be executed by machines or system software This automation reduces manual effort, enhances accuracy and increases productivity in various fields - Algorithms provide a systematic approach to make it easier to manage, analyze and solve problems efficiently  Disadvantages of Algorithms: - Algorithms are highly complex and to understand them is a big challenge, difficult to design, implement and maintain - Algorithms operate based on predefined steps and logical rules They lack the ability to think creatively or adapt to novel situations, which limits their problem-solving capabilities in certain domains - Inability to solve problems that produce non-computing results 1.3.2 Steps to write a good algorithm: Step 1: Clearly define the problem to be solved and the goal of the algorithm Step 2: Break down the problem into smaller steps Identify the key components and tasks that need to be done to achieve the desired results Step 3: Clearly define the input and output of the algorithm Define the data types, formats, and validation associated with them Step 4: Plan the logic of the algorithm Determine the sequence of steps and decisions needed to solve the problem Step 5: Use pseudocode or flowchart Step 6: Improve methods for maximum efficiency Step 7: Check for accuracy and repair any faults you notice Step 8: Rewrite the algorithm and run tests to make sure it works well and gives correct results in all cases 1.3.3 Example  Write a C# program to solve quadratic equation 2: ax2 + bx + c = - Step 1: Declare variables a, b, c of the quadratic equation - Step 2: Enter the values a, b, c from the keyboard - Step 3: Parse the user input and store the values in the respective variables Page - Step 4: We calculate delta and compare them if delta is greater than then "Equation has distinct solutions" Less than then "Equation has no solution" Equal to then "Equation has double solutions" - Step 5: Analyze the problem: o o o o Create an input variable a, b, c Input a, b, c from the keyboard Delta = b^2 – 4*a*c Write an "if else" condition where Delta > is "Equation has distinct solutions" , Delta < is "Equation has no solution" , and Delta = is "Equation has double solutions" Algorithmic flowchart of the problem: Figure Flowchart for example Page 10 Algorithmic flowchart of the problem: Page 11 - Step 6: Optimization: This algorithm is already quite optimized and does not need any further improvement - Step 7: Check and fix errors Check by running the algorithm with cases If there is an error, then modify the algorithm until the result is correct - Step 8: Rewrite the algorithm After we have modified the algorithm until it works correctly, we can rewrite it to keep the code clean and readable 1.4 Steps in program development: Step 1: Analyze and define the problem: The computer user must figure out the problem, then decide how to resolve the problem - choose a program Step 2: Create a solution: This step entails creating an algorithm, a document, or an extensive software architecture as a resolution to the problem Step 3: Program design: A flow chart is important to use during this step of the PDLC This is a visual diagram of the flow containing the program This step will help you break down the problem Step 4: Code program: This is using the language of programming to write the lines of code The code is called the listing or the source code The computer user will run an object code for this step Step 5: Debugging the program: The computer user must debug This is the process of finding the "bugs" on the computer The bugs are important to find because this is known as errors in a program Step 6: Testing: One must run the program to make sure there are no syntax and logic errors Syntax are grammatical errors and logic errors are incorrect results Step 7: Deployment and maintenance: This step is the final step of gathering everything together Internal documentation is involved in this step because it explains the reasoning one might of made a change in the program or how to write a program Figure Steps in program development Page 12 1.4.1 Example of steps in program development:  Print the largest number out of numbers entered from the keyboard - - Page 13 Step 1: Step 2: Step 3: Step 4: Step 5: Code program: Determine the steps taken from writing code to execute (M1) 2.1 The steps involved from writing code to executing the code depend on the programming language and development environment Page 14 Page 15 Page 16 Page 17

Ngày đăng: 15/06/2023, 19:06

Tài liệu cùng người dùng

Tài liệu liên quan