Docsity

Programming Algorithms and Problem Solving, Schemes and Mind Maps of Mathematics

Toggle sidebar
bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 1: Programming
Submission date August 12, 2022 Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name NGUYEN HA NHAT LINH Student ID GCC210269
Class GCC1002 Assessor name NGUYEN HUNG DUNG
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 LINH
Grading grid
P1 M1 D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Programming Algorithms and Problem Solving and more Schemes and Mind Maps Mathematics in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date August 12, 2022 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name NGUYEN HA NHAT LINH Student ID GCC Class GCC1002^ Assessor name NGUYEN^ HUNG DUNG 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 LINH Grading grid P1 M1 D

 Summative Feedback:  Resubmission Feedback:

Grade:

Assessor Signature:

Date: Lecturer Signature:

● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply this requirement will result in a failed assignment. Unit Learning Outcomes: LO1 Define basic algorithms to carry out an operation and outline the process of programming an application Assignment Brief and Guidance: Assignment 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 do 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). Tasks:  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 program  Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language. Learning Outcomes and Assessment Criteria (Assignment 1): Learning Outcome Pass Merit Distinction LO1 (^) 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

I. Chapter 1 - State your simple business problems to be solved (P)

Definition of algorithms

  • The word Algorithm means ” A set of rules to be followed in calculations or other problem-solving operations ” Or ” A procedure for solving a mathematical problem in a finite number of steps that frequently by recursive operations “.
  • Therefore Algorithm refers to a sequence of finite steps to solve a particular problem.
  • Algorithms can be simple and complex depending on what you want to achieve. Figure 1 Algorithms
  • It can be understood by taking the example of cooking a new recipe. To cook a new recipe, one reads the instructions and steps and executes them one by one, in the given sequence. The result thus obtained is the new dish cooked perfectly. Every time you use your phone, computer, laptop, or calculator you are using Algorithms. Similarly, algorithms help to do a task in programming to get the expected output.
  • The Algorithm designed are language-independent, i.e. they are just plain instructions that can be implemented in any language, and yet the output will be the same, as expected. (geeksforgeeks, 2022)

 C haracteristics of algorithms

Figure 2 Characteristics of an Algorithm

  • As one would not follow any written instructions to cook the recipe, but only the standard one. Similarly, not all written instructions for programming is an algorithms. In order for some instructions to be an algorithm, it must have the following characteristics:  Clear and Unambiguous : The algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.  Well-Defined Inputs : If an algorithm says to take inputs, it should be well-defined inputs.  Well-Defined Outputs : The algorithm must clearly define what output will be yielded and it should be well-defined as well.  Finite-ness : The algorithm must be finite, i.e. it should terminate after a finite time.  Feasible : The algorithm must be simple, generic, and practical, such that it can be executed with the available resources. It must not contain some future technology or anything.  Language Independent : The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected.  The steps of building an application
  • The various stages in the development of a computer program are :
  • This stage of program development is an important process. Debugging is also known as program validation.
  • Some common errors which might occur in the programs include:
  • Un initialization of variables.
  • Reversing of order of operands.
  • Confusion of numbers and characters.
  • Inverting of conditions eg jumping on zero instead of on not zero. 1.5 Testing
  • The program is tested on a number of suitable test cases.
  • A test plan of the program has to be done at the stage of the program design itself.
  • This ensures a thorough understanding of the specifications.
  • The most trivial and the most special cases should be identified and tested.
  • It is always useful to include the maximum and minimum values of all variables as test data. 1.6 Documentation
  • Documentation is a very essential step in the program development.
  • Documentation help the users and the people who maintain the software.
  • This ensures that future modification if required can be done easily. Also it is required during redesigning and maintenance. 1.7 Maintenance
  • Updating and correction of the program for changed conditions and field experience is accounted for in maintenance.
  • Maintenance becomes essential in following situations:
  • Change in specification,
  • Change in equipment,
  • Errors which are found during the actual execution of the program. (cseworldonline, 2020)

II. Chapter 2 - Analyze the problem and design the solutions by the use of suitable

methods. (P)

1. Analyze the problem 1.1. Specifying the input requirements: No Variable Data type Describe 1 n int The variable n is used to enter the total number of values that the user wants to enter into the array. 2 numbers int enter the desired value for the user to add to the "number" variable 1.2. Specifying the output requirements: No Variable Data type Describe 1 min int compare with input values and find smallest value in array 2. Specifying the processing requirements: First, the program will display a message asking the user to enter the total amount that the user wants. Next, the program will take the number that the user has just entered to check into the array. If the user enters the array as a negative number, the program will report an error and the program will immediately stop. When the user enters the correct number in the array, the chapter will be stored in the array. Then the program will make the variable "min" equal to the first element of the array "number". Next, the for loop is used to look at the elements in the array, if the value of the min variable is greater than the element of the array at position 'i', then the min variable will receive the value at that element and the loop will perform the process until the end of the loop, the min variable will receive the minimum value of the element in the

III. Chapter 3 - Demonstrate the compilation and running of a program (M)

1) Demonstrate how the application is implemented  source code of the program us ng System; us ng System.Collect ons.Gener c; us ng System.L nq; us ng System.Text; us ng System.Thread ng.Tasks; namespace ConsoleApp 30 { nternal class flrogram { stat c vo d Ma n(str ng[] args) { Console.Wr teL ne("Enter the number of array elements "); nt n = nt.flarse(Console.ReadL ne()); wh le (n < 2) { Console.Wr teL ne("The number of array elements must be larger than 1 !"); Console.Wr te("please enter aga n: "); n = nt.flarse(Console.ReadL ne()); } nt[] numbers = new nt[n]; for ( nt = 0; < n ; + +) { Console.Wr te("enter the th element { 0 }: ",

  • 1 ); numbers[ ] = nt.flarse(Console.ReadL ne()); } nt m n = numbers[ 0 ]; for ( nt = 1; < n ; ++) { f (m n > numbers[ ]) { m n = numbers[ ]; } } Console.Wr teL ne("smallest value n array: " + m n); } } }  Screenshots the program: o This is the first interface the user encounters when the program launch.

Figure 4. The first interface when the program launches o Next, if the user enters the number of the array as a negative number, the program will report an error and the program will ask you to re-enter it. Figure 5 the number of the array as a negative number o Next the program will ask the user to enter the correct number for the array. Figure 6 The program will ask the user to enter the correct number for the array_._ o Next the program asks the user to enter the total number of students and enter each quantity into the array.

compiled. All these errors are generally detected by the compiler and thus are known as compile-time errors. For example, missing semicolon, missing parenthesis, etc. Runtime error: Errors that occur during program execution(run-time) after successful compilation is called run-time errors. One of the most common run-time errors is division by zero also known as Division error. These types of errors are hard to find as the compiler doesn’t point to the line at which the error occurs. Step 4: Languages such as Java or C# are not directly converted or compiled into machine-level language or machine instructions. These languages need to be converted to an intermediate code first, which is a partially half compiled code. For C#, the source code is converted to an intermediate code which is known as Common Intermediate Language (CIL) or Intermediate Language Code (ILC or IL code). This CIL or IL Code can run on any operating system because C# is a Platform Independent Language. Step 5: After converting the C# source code to Common Intermediate Language (CIL) or Intermediate Language Code (ILC or IL code, the intermediate code needs to be converted to machine understandable code. C# uses the .NET Framework and as part of this .NET Framework, the Virtual Machine component manages the execution of programs written in any language that uses the. NET Framework. This virtual machine component is known as Common Language Runtime (CLR) which translates the CIL or IL code to native code or machine understandable code or machine instructions. This process is called the Just-In-Time (JIT) Compilation or Dynamic Compilation which is the way of compiling code during the execution of a program at run time only. Step 6: Once the C# programs are compiled, they’re physically packaged into Assemblies. An assembly is a file that contains one or more namespaces and classes. As the number of classes and namespaces in program grows, it is physically separated by related namespaces into separate assemblies. Assemblies typically have the file extension. exe or .dll , depending on whether they implement applications or libraries respectively, where EXE stands for Executable and DLL stands for Dynamic Link Library. An EXE (Executable) file represents a program that can be executed and a DLL (Dynamic Link Library) file includes code (Eg: Library) that can be reused across different programs. Step 7: Now, the C# compiler returns the output of the given c# code.

1 (geeksforgeeks, 2021) IV. Chapter 4 - Evaluate how the problem is solved from the designed algorithm to the executionprogram written by a specific programming language. (D) Test Plan

Index of comments 2.1 Strength

  • You have defined the algorithm and its properties.
  • You have demonstrated and understood the steps to build the application.
  • You presented the problem and solved it step by step. Weakness
  • You need to format the content appropriately. You need to adjust the font size again.
  • "the chapter will be stored in the array" => "the program will store in the array" Improvement
  • You need to improve the above weaknesses
  • You need to improve your English to do better assignments. 2.2 Nguyen Hung Dung 2.3 24/8/ 2.4 Merit