



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An overview of algorithms and programming, focusing on the implementation of algorithms to solve linear and quadratic equations. It covers the definition of algorithms, their step-by-step nature, and how they are used in computer programming. The document then delves into a practical example of cooking rice, demonstrating the step-by-step nature of algorithms. It also discusses the various stages of program development, including requirements analysis, architectural design, coding, testing, and maintenance. The document then presents a program that allows the user to select options to solve linear and quadratic equations, providing detailed explanations of the underlying algorithms and their implementation. Overall, this document serves as a comprehensive guide to understanding algorithms, their role in programming, and their practical applications in solving mathematical problems.
Typology: Study Guides, Projects, Research
Uploaded on 07/17/2023
1 document
1 / 27
This page cannot be seen from the preview
Don't miss anything!




















Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class Assessor name Ngo Thi Mai Loan Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P1 M1 D
❒ Summative Feedback: ❒ Resubmission Feedback:
Grade: Assessor Signature: Date: Lecturer Signature:
A. Introduction Writing computer code to develop a program or solve an issue is referred to as programming. Algorithms are implemented using programs. Algorithms can be expressed as pseudocode or flowcharts, and programming is the process of converting them into computer programs. To instruct a computer, a program must be designed that specifies what to do and how to accomplish it. If an algorithm has been created, the computer program will follow it step by step, telling the machine exactly what to do. Programming is really about problem solving. It entails breaking difficult issues down into smaller, more manageable chunks and creating solutions to them. Programmers evaluate issues, create algorithms, and transform them into computer code. There are many programming languages available, each with its own syntax and purpose. These languages serve different purposes and are used in different fields, such as web development, data analysis, and game development. I will introduce this in Assignment 1.
2. Algorithm characteristics An algorithm has the following characteristics:
Figure 2. Algorithm characteristics
1. Finiteness: An algorithm must terminate after a limited number of steps. 2. Unambiguous: An algorithm must be precisely defined; each step should be clear and their inputs, outputs must lead to only one meaning. 3. Input: An algorithm should have zero or more well-defined inputs which are given to it initially before the algorithm begins. 4. Output: An algorithm should have one or more well-defined outputs and should match the desired output.
5. Effectiveness: All of the operations to be executed in the algorithm should be realizable that they can be done exactly in a limited length of time. 3. Algorithm example Practical example: Cooking rice a. Step 1: Measure the rice and put into cooking pot
b. Step 2: Rinse the rice
e. Step 5: Fluff and serve
Figure 7 : Step 5 of cooking rice
Algorithm example in math: Find the area of a rectangle.
The various stages in the development of a computer program are :
Figure 9. Steps in program development
+Complete input and outputs for a module. It is very important that the module designed is appropriate with the other modules in the system construction and the other external systems. The unit tests can be developed in this stage based on the internal module designs. 3.Coding: All of the module’s design is convert into code by the developers in this step. The most suitable programming language is decided according to the system and architecture requirements. The coding is implemented based on the coding guidelines and standards. The code is went through numerous code reviews and finally optimized for the best performance. Unit testing is executed by the developers on the code written by them.
4. Documentation: -It’s very importance for developers to write technical documentation precisely. The code documents which is a part of source code (include README files or API documentation) or includes reference manuals, algorithm descriptions, flowcharts. Documentation is very helpful for development, maintenance, and knowledge transfer to other developers. It must be detailed but not verbose. Because if the documentation is lengthy, it would become very time-consuming to read or difficult to maintain them. 5. Compiling and running the program: -When developers create a program, they first write the program in source code form which is written in a specific programming language. Those code files in a text form that can be opened and edited by developers. Because the source code can’t be performance directly by computers. So, it must be converted from source code into machine code for computer can understand, this process is called “Compiling”. -Execution in computer programs is the process in which a program is loaded into the computer’s memory and then program ‘s instructions are executed. Most of the programs is executed with the support of an operating system and specific run-time libraries. 6. Testing: 6.1. Unit Test Plans (UTPs) are developed in module design step would performance now. The unit tests are a very necessary part of any application develop procedure and helps eliminate most of errors that can generate at a very early phase.
A unit like a program module is the smallest entity in the whole system. Unit testing check that the module can execute exactly when isolated from the rest of the units of system. 6.2. Integration testing: Integration Test Plans are developed in the Architectural Design step. Integration Testing performed to make sure that all of the modules created before which tested independently in UTPs can coexist and communicate among themselves within the system. Then Test results are shared with the client ‘s team. 6.3. System testing: System testing is strictly related with the system design stage. Unlike Unit and Integration Testing, System Test Plans are constructed by client's team. System Test plan ensures that all of the client ’s expectations are met. The entire application ’s system is tested for its functionality, interdependency and communication. System Testing authenticates those functional and non- functional requirements are met. Load and performance testing, stress testing, regression testing. Most of the problems about the compatibility between hardware and software can be discovered during this step. 6.4. Acceptance testing: User Acceptance Test (UAT) Plans are developed in the Requirements Analysis step. Test Plans are constructed by the user. UAT is executed in user environment and using realistic data to find out the incompatibility with the other systems. UAT confirms that complete system meets all the requirement of user and ready for use in actual time. It also detects the non-functional errors such as load and performance defects in the real time user environment. *** Debugging:** is a process of detecting and fixing the problems that prevent the program operating correctly. Developers can use debugging tools to check and correct errors in the program. In case of large program, the source code is divided into many small components which are debugged separated. Next stage is the whole program.
7.Maintenance: In computer programming, the concept of maintenance is referred to modify a software product after deployment step to correct errors, improve performance and attributes. But in reality, maintenance is more similar to enhance functionality of the system or fixing faults. Its purpose is to meet the changing with new technologies and requirements.
Press key 1: Solve the first order equation. Press key 2: Solve quadratic equation. Press key 3: Exit. Press key 1: Solve the linear equation The Solve Linear Equation function solves a linear equation of the form "ax + b = 0". It prompts the user to enter the values of coefficients 'a' and 'b', and then calculates the solution 'x' that satisfies the equation. The function handles different scenarios, including cases where 'a' is zero or 'b' is zero
Inputs:
Press key 2: Solve quadratic equation. The Solve Quadratic Equation function solves a quadratic equation of the form "ax^2 + bx + c = 0". It prompts the user to enter the values of coefficients 'a', 'b', and 'c', and then calculates the solutions 'x1' and 'x2' that satisfy the equation. The function handles different scenarios based on the discriminant value (b^2 - 4ac) to determine the nature of the solutions (real, complex, or no real solutions).
Outputs:
If later, it will switch to key 3, if it is correct, the program will automatically exit, if it is wrong, it will automatically print on the screen the words "The option does not exist, please re-enter the value from 1 - 3. "
5. Functions The first function : Solve Linear Equation