Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Visual programming for freshman, Exams of Compilers

Visual programming for freshman. You will be able to use C# skillfully

Typology: Exams

2020/2021

Uploaded on 05/10/2021

jackie-ming
jackie-ming 🇬🇧

8 documents

1 / 12

Toggle sidebar

Related documents


Partial preview of the text

Download Visual programming for freshman and more Exams Compilers in PDF only on Docsity! Higher Nationals in Computing Programming ASSIGNMENT No.1 Learner’s Name: DOAN THANH DUNG Assessor Name: NGUYEN VAN SON Class: 1618 GCS0901 ID: GCS200419 Assignment due: Assignment submitted: 2 ASSIGNMENT 1 FRONT SHEET 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 Đoàn Thanh Dũng Student ID GCS200419 Class GCS0901 Assessor name Nguyễn Văn Sơn 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 Dũng Grading grid P1 M1 D1 ❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature: 5 Guideline Assignment 1 1. Algorithm and outline the process in building an application (P1) ............................. 6 1.1.1. Algorithm ............................................................................................................... 6 1.1.2. Outline the process in building an application ......................................................... 6 2. The steps taken from writing code to execution (M1) ................................................ 7 2.1.1. Defining or Analyzing the problem ......................................................................... 7 2.1.2. Design (Algorithm) ................................................................................................. 7 2.1.3. Coding .................................................................................................................... 7 2.1.4. Documenting the program ...................................................................................... 7 2.1.5. Compiling and running the program ...................................................................... 7 2.1.6. Testing and Debugging ........................................................................................... 8 2.1.7. Maintenance ........................................................................................................... 8 3. Examine the implementation of an algorithm in a suitable language. (D1) ................ 8 3.1. Problem description ................................................................................................... 9 3.2. Analysis ..................................................................................................................... 9 3.3. Implementation (using C#) ....................................................................................... 10 3.4. Run and test ............................................................................................................. 11 4. Evaluate the relationship between the written algorithm and the code variant (D1) .. 11 5. Referrences .......................................................................................................... 11 6 1. Algorithm and outline the process in building an application (P1) 1.1.1. Algorithm When we talk about an algorithm, what is it exactly? In mathematics and computer science, an algorithm is a step-by-step procedure for calculations. Algorithms are used for calculation, data processing, and automated reasoning. [1] The human use algorithm as well. We might have algorithms for getting from home to our workplaces, for making a glass of lime juice, for boiling an egg, or for counting people in a room. For example step by step for boiling eggs: Step1: We place eggs into a pan large enough to hold them all. Then pour cold water into the egg pan. Step2: Heat the pan over high heat until boiling. Step3: When the water is boiled, remove the pan from the cooker and let the eggs sit there for about 10 minutes. Drain the eggs from warm water and dip them into cold or ice water. 1.1.2. Outline the process in building an application In order to write a program, we need to understand the algorithm for that specific problem. There are steps involved need to follow before finish a program: ø Defining or Analyzing the problem ø Design (Algorithm) ø Coding ø Documenting the program ø Compiling and running the program ø Testing and Debugging ø Maintenance 7 2. The steps taken from writing code to execution (M1) 2.1.1. Defining or Analyzing the problem Defining the problem before writing the app helps us easy to understand the case, also investigating the problem let you know the ways on how to complete the app. Defining the problem before writing the app helps us easy to understand the case, also investigating the problem let you know the aspect on how to complete the app. 2.1.2. Design (Algorithm) After knowing what specific tasks you are going to do, the design part will be the next thing that we need to do. Drawing Use-Case diagram, flowchart, pseudo code are three of the most likely we all use. A UML use case diagram is the primary form of system/software requirements for a new software program underdeveloped. Use cases specify the expected behavior (what), and not the exact method of making it happen (how). Use cases once specified can be denoted both textual and visual representation (i.e. use case diagram). A key concept of use case modeling is that it helps us design a system from the end user's perspective. It is an effective technique for communicating system behavior in the user's terms by specifying all externally visible system behavior [2]. In general, the use case diagram shows the relationship between actor, system, cases. A flowchart is a type of diagram that represents a workflow or process. A flowchart can also be defined as a diagrammatic representation of an algorithm, a step-by-step approach to solving a task. [3] The last thing is pseudo-code is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language but is intended for human reading rather than machine reading. [4] 2.1.3. Coding In this stage, coding is the part of writing the program. We use all the algorithms that we analyzed and designed to construct and give logical form to the program. 2.1.4. Documenting the program The document needs to explain how the program work which is known as the user manual, also the document have to show confused or easy forgotten pieces of the program for the users can handle it. The maintenance manual is needed in the documentation. 2.1.5. Compiling and running the program In computing, a compiler is a computer program that translates computer code written in one programming language (the source language) into another language (the target language). 10 Pseudo-code: Step1: Start. Step2: Declare variables n, fact, i. Step3: Set fact =1 and i=1. Step4: Input n from the keyboard. Step5: if n=0: True: Step5.1: set fact=1. Step5.2: Go to step7. False: Step5.1: Go to step6. Step6: if I <= n: True: Step6.1: Set fact = fact*I then i=i+1. Step6.2: Go to step6. False: Step6.1: Go to step7. Step7: Print fact to the screen. Step8: End. 3.3. Implementation (using C#) Code: 11 3.4. Run and test Output: Test table: Number Test case step Expected output Actual output Result 1 Validate n Input positive n = 3 Factorial number of 3 is 6 Factorial number of 3 is 6 Pass 2 Validate n Input n=0 Factorial number of 0 is 1 Factorial number of 0 is 1 Pass 3 Invalidate n Input negative n=-3 Program will ask to enter n again: “Enter n to process: “ Enter n to process: Pass 4. Evaluate the relationship between the written algorithm and the code variant (D1) Algorithm and code are two separate fields. The algorithm can be used in any type of language and can be written in any programming language. Because the algorithm is the way how we can solve the problem to get the answer. On the other hand code variant is the set of programming language for the computer to understand, it can only be written down if we have the algorithm to describe what we need to do in order to process. 5. Referrences [1] MALAN, D., 2021. WHAT'S AN ALGORITHM? - DAVID J. MALAN. [ONLINE] TED-ED. AVAILABLE AT: <HTTPS://ED.TED.COM/LESSONS/YOUR-BRAIN-CAN-SOLVE-ALGORITHMS- DAVID-J-MALAN#DIGDEEPER> [ACCESSED 26 JANUARY 2021]. 12 [2] VISUAL-PARADIGM.COM. 2021. WHAT IS USE CASE DIAGRAM?. [ONLINE] AVAILABLE AT: <HTTPS://WWW.VISUAL-PARADIGM.COM/GUIDE/UML-UNIFIED-MODELING-LANGUAGE/WHAT-IS- USE-CASE-DIAGRAM/> [ACCESSED 26 JANUARY 2021]. [3] EN.WIKIPEDIA.ORG. 2021. FLOWCHART. [ONLINE] AVAILABLE AT: <HTTPS://EN.WIKIPEDIA.ORG/WIKI/FLOWCHART> [ACCESSED 26 JANUARY 2021]. [4] EN.WIKIPEDIA.ORG. 2021. PSEUDOCODE. [ONLINE] AVAILABLE AT: <HTTPS://EN.WIKIPEDIA.ORG/WIKI/PSEUDOCODE> [ACCESSED 26 JANUARY 2021]. [5] EN.WIKIPEDIA.ORG. 2021. COMPILER. [ONLINE] AVAILABLE AT: <HTTPS://EN.WIKIPEDIA.ORG/WIKI/COMPILER> [ACCESSED 26 JANUARY 2021].
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved