Docsity

BTEC HND Computing Assignment 1: Problem Solving with Algorithms, Exercises of Database Programming

Toggle sidebar
bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and Unit 1: Programming
title
Submission date 12/08/2021 Date Received 1st
submission
Re-submission Date Date Received 2nd
submission
Student Name Student ID
Class Assessor name
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 D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download BTEC HND Computing Assignment 1: Problem Solving with Algorithms and more Exercises Database Programming in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and Unit 1: Programming title Submission date 12/08/ Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class Assessor name 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:

● 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 M1 Determine the steps D1 Examine the of what an algorithm is taken from writing code implementation of an and outline the process to execution. algorithm in a suitable in building an language. Evaluate the application. relationship between the written algorithm and the code variant.

I. STATE YOUR SIMPLE BUSINESS PROBLEMS TO BE SOLVED

1. Definition of algorithms, characteristics of algorithm: a. Definition of algorithms An algorithm is a set of instructions for solving a problem or accomplishing a task. One common example of an algorithm is a recipe, which consists of specific instructions for preparing a dish or meal. Every computerized device uses algorithms to perform its functions. Source: investopedia.com b. Characteristics of an Algorithm: Clear and Unambiguous: 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 not end up in an infinite loops or similar. Feasible: The algorithm must be simple, generic and practical, such that it can be executed upon will 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 same, as expected. Source: geeksforgeeks.org 2. Explain the steps of building an application The steps of building an application: a. General analysis and requirements gathering: In programming improvement, necessities for the items to be planned are obtained in this progression. Undertaking directors, intrigued partners accumulate around to meet and set up together the necessities , After the prerequisites have been assembled, and questions like above have been replied, investigation of the circumstances comes straightaway. b. Product Design: in programming improvement, necessities for the items to be planned are obtained in this progression. Undertaking directors, intrigued partners accumulate around to meet and set up together the necessities , After the prerequisites have been assembled, and questions like above have been replied, investigation of the circumstances comes straightaway. A prerequisite detail

collection of documents is made. c. Coding: After the period of the project plan, the improvement group proceeds onward to the phase of coding and execution. Other than coding, the engineers additionally perform unit or module testing in this stage, as to distinguish potential issues as right on time as feasible in the advanced stage. d. Testing Programming improvement benefit groups are in the regular procession of discharging characteristic programming applications for numerous purposes. Consequently, this procedure is essential as it is vital to test the item against all factors accessible actively. e. Deployment of the Product: Once the software item passes the testing stage, an organization of the item can follow. Once the item is prepared, the significant cluster is taken off and opened to general society. f. Maintenance and Operations: After each of the preceding steps has been successfully completed and the software item has been fully released into the market, the item must be kept running, and support is required. If the product's customer base continues to grow, additional processing power, memory, and database limits should be added to maintain the software working efficiently. Source: dotnetlanguages.net

3. Analyze the problem and design the solutions by the use of suitable methods a. Solution: The problem requires entering a positive integer n, calculating the arithmetic progression of n and displaying it on the screen b. How the algorithm can help solve it. Use the variable n to store the value of a positive integer (n > 0). Use a for loop: initialize i = 1, add initial arithProg = 0, repeat the addition of i with arithProg. After each addition, we increase by 1 unit until i = n, then stop and print the result to the screen. Use the try-catch statement to check for an exception if n is not of the int data type.

III. DEMONSTRATE THE COMPLICATION AND RUNNING OF A MENU-BASED

PROGRAM

1. Compiler time process

  • The .Net framework has one or more language compilers, such as Visual Basic, C#, Visual C++, JScript, or one of many third-party compilers such as an Eiffel, Perl, or COBOL compiler.
  • Anyone of the compilers translates your source code into Microsoft Intermediate Language (MSIL) code.
  • For example, if you are using the C# programming language to develop an application, when you compile the application, the C# language compiler will convert your source code into Microsoft Intermediate Language (MSIL) code.
  • In short, VB.NET, C#, and other language compilers generate MSIL code. (In other words, compiling translates your source code into MSIL and generates the required metadata.)
  • Currently "Microsoft Intermediate Language" (MSIL) code is also known as the "Intermediate Language" (IL) Code or "Common Intermediate Language" (CIL) Code. SOURCE CODE -----.NET COMLIPER------> BYTE CODE (MSIL + META DATA) Source: c-sharpcorner.com

2.Source code EXPLAIN: Enter n from the keyboard with n>0. If n is valid, initialize i = 1, use a for loop to repeat the addition of i with the initial arithmetic sum arithProg = 0. After each addition i increment by 1, repeat until i= n then stop. Then print the results to the screen.

This code checks the condition of n. Then use a for loop to calculate the additive exponent of n. For i = 1, i is increasing; add i with arithProg and repeat until i <= n then stop to print to screen. Next comes the next code execution. This code will give an error to the user if n is not of type int and exits the program Or Or

IV. EVALUATE HOW THE PROBLEM IS SOLVED FROM THE DESIGNED

ALGORITHM TO THE EXECUTION PROGRAM WRITTEN BY A SPECIFIC

PROGRAMMING LANGUAGE:

1. Evaluate the problem is solved from the designed algorithm to the execution program written by a C# programming language: Algorithms describe how to solve a problem in terms of the data needed to represent the problem case and the steps required to achieve the expected result. The programming language must provide symbols to represent both the process and the data. Finally, the language provides control structures and data types. Algorithms require at least constructs that perform sequential processing, selection decisions, and iterations to control repetition. As long as the language provides instructions, it can be used to represent algorithmic objects. In addition, the data type also provides a description of the operations to which data items can be added. We expect that numeric data types can participate in these arithmetic operations. The difficulty that often arises for us is the fact that problems and their solutions are strongly combinatorial. The simple data types and structures provided by this language are certainly enough to represent complex solutions, but it is often at a disadvantage when solving a process problem. An algorithm is a step-by-step procedure to solve a certain problem while pseudocode is a method of writing an algorithm. Usually, there can be several methods to solve a problem. It is important to analyze each solution and choose the best approach to solve it. On the other hand, pseudocode is a method of developing an algorithm. Programmers can use an informal simple language to write pseudocode and there is no strict syntax to follow. It is a text-based detail design tool. Source: pediaa.com 2. Prove using the app can solve the problem: When the user enters a valid value When the user enters an invalid value Proof: the problem can be solved by the most specific algorithms. Optimize everything. Faster and more accurate, and this algorithm can be compiled into approximate programming languages. Example: apply. Use algorithms of the C programming language and compare.

ask to re-enter until valid 5 verify "Invalid! Please execute the program again.:" when user enters n as data type character and exits the program 6 verify "Invalid, please retype:" when user enters n as a special string and exits the program 7 verify "Invalid, please retype:" when user doesn't type n value but just press enter and ask to re-enter until valid 8 verify "Invalid, please re-enter:" when the user enters the value n as a math character and exits the program a Display " Invalid, Display fail please enter “Invalid! Please again: " and ask to execute the re-enter program again. “ llbm Display " Invalid, Display fail please enter “Invalid! Please again: " and ask to execute the re-enter program again. “ “ " Display " Invalid, Display fail please enter “Invalid! Please again: " and ask to execute the re-enter program again. “ +*/ Display " Invalid, Display fail please enter “Invalid! Please again: " and ask to execute the re-enter program again. “

References dotnetlanguages, 2018. dotnetlanguages. [Online] Available at: https://www.dotnetlanguages.net/six-steps-in-the-programming-process/ [Accessed 12 8 2021]. geeksforgeeks, 2020. geeksforgeeks. [Online] Available at: https://www.geeksforgeeks.org/introduction-to-algorithms/ [Accessed 5 8 2021]. hc-sharpcorner, 2020. c-sharpcorner. [Online] Available at: https://www.c-sharpcorner.com/UploadFile/8911c4/code-execution-process/ [Accessed 12 8 2021]. investopedia, 2021. investopedia. [Online] Available at: https://www.investopedia.com/terms/a/algorithm.asp [Accessed 5 8 2021]. investopedia, 2021. investopedia. [Online] Available at: https://www.investopedia.com/terms/a/algorithm.asp [Accessed 12 8 2021]. pediaa, 2018. pediaa. [Online] Available at: https://pediaa.com/difference-between-algorithm-and-pseudocode/ [Accessed 12 8 2021].