Docsity

assignment 1 programlanguge M, Schemes and Mind Maps of Programming Languages

Toggle sidebar
bg1
1618 GCS2005 55 Nguy
ễ
n Thúy My Assignment 1
Information Technology (IT 2021)
Higher Nationals in Computing
Unit 1: Programming
ASSIGNMENT 1
Learner’s name: Nguyen Thuy My
ID: GCS200555
Class: GCS0905C
Subject code: 1618
Assessor name: PHAN MINH TAM
Assignment due: Assignment submitted:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21

Partial preview of the text

Download assignment 1 programlanguge M and more Schemes and Mind Maps Programming Languages in PDF only on Docsity!

1618 GCS2005 55 Nguyễn Thúy My Assignment 1

Information Technology (IT 2021)

Higher Nationals in Computing

Unit 1: Programming

ASSIGNMENT 1

Learner’s name: Nguyen Thuy My

ID: GCS

Class: GCS0905C

Subject code: 1618

Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:

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 Nguyen Thuy My Student ID GCS

Class GCS0905C Assessor name Phan Minh Tam

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

Assignment Brief 1 (RQF)

Higher National Certificate/Diploma in Computing

Student Name/ID Number: Nguyen Thuy My/GCS Unit Number and Title: Unit 1: Programming Academic Year: 2021 – 2022 Unit Assessor: Phan Minh Tam Assignment Title: Problem solving with algorithms Issue Date: 27 September 2021 Submission Date: Internal Verifier Name: Date:

Submission Format:

Format:

● The submission is in the form of an individual written report. 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 Tutor. ● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/. ● Remember to convert the word file into PDF filebefore the submission on CMS.

Note:

● The individual Assignment must be your own work, and not copied by or from another student. ● 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 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

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. Evaluatethe relationship between the written algorithm and the code variant.

  • INTRODUCTION
  • application................................................................................................. P1. Provide a definition of what an algorithm is and outline the process in building an - 1. Overview about Algorithm - 1.1. Definition of algorithms - 1.2. Some Algorithms - 1.3. Example of algorithms - 2. Characteristics algorithm - 3. Software Development Life Cycle (SDLC) - 3.1. Definition - 3.2. The entire SDLC process - 4. Represent a small and simple problem - 5. Analyze the problem - 5.1. Library - 5.2. Data tyle and variable - 6. Use-case diagram - 7. Flowchart - 7.1. Select menu funtion - 7.2. Input book’s information....................................................................................................... - 7.3. Print book’s information........................................................................................................ - 7.4. Print the most and the least quantity book - 7.5. Print the highest price book...................................................................................................
  • M1. Determine the steps taken from writing code to execution - 1. Coding standard - 1.1. Declare library, variable and array......................................................................................... - 1.2. Select menu function - 1.3. Input book’s information....................................................................................................... - 1.4. Print’s book’s information..................................................................................................... - 1.5. Print the least quantity book - 1.6. Print the higest price book..................................................................................................... - 1.7. The rest of the coding standard
      1. Results of the program
      • 2.1. Input book’s information.......................................................................................................
      • 2.2. Print book’s information........................................................................................................
      • 2.3. Print the least quantity book
      • 2.4. Print the highest price book...................................................................................................
  • relationship between the written algorithm and the code variant D1. Examine the implementation of an algorithm in a suitable language. Evaluate the
      1. Test case
    • program written in a particular programming language 2. Evaluate how to solve a problem from the design algorithm to the implementation of a
  • REFERENCES

P a g e | 1

ASSIGNMENT 1 ANSWERS

I NTRODUCTION

Algorithms have existed for a long time, they help people in most fields such as math, science,... And now, in the 4.0 era, they support a lot in the field of science. calculator. They make it easier for people to create and develop high-tech software and products by solving each algorithm and combining them.

In this assignment, I will present the concept of algorithms, examples of algorithms in life, present a small problem and how to solve it using algorithms, diagrams and and use C# programming language to solve that problem.

P1. Provide a definition of what an algorithm is and outline the process in building an application.

1. Overview about Algorithm

1.1. Definition of algorithms

An algorithm is a method, formula, or a specific finite-step procedure for solving a problem that is based on performing a series of specified actions. A computer program may be thought of as a complex algorithm. in mathematics and computer science , an algorithm is a short process that solves a recurring issue. The term algorithm is derived from the name of a mathematician, Mohammed ibn-Musa al-Khwarizmi, who flourished between 780 and 850 and was a member of Baghdad's royal court. Al-work Khwarizmi's is also the most likely origins of the term algebra.

P a g e | 3

1.3. Example of algorithms < Find the second largest value of 10 interger numbers entered from the keyboard =

To implement the algorithm and produce its results, we have:

Input: 10 integers entered from the keyboard

Output: the second value of the sequence

Algorithm solving process:

After solving the above algorithm, the result of the main algorithm is MAX

Flochwart:

STEP 1: STAR

STEP 2: Decalera MAX = 0, Array B[10] STEP 3: Set variable i = 0 STEP 4: for i < length of array B, repeat STEP 5 STEP 5: Read B [i] STEP 6: if N[i] > MAX is true then STEP 6.1: Set MAX= B[i] STEP 8: Read MAX STEP 9: Decalera MAX2 = 0 STEP 10: for i < length of array B, repeat STEP 5 STEP 11: Read B[i] STEP 12: if B[i] > MAX2 and B[i] < MAX is true then STEP 12.1: Set MAX2 = B[i] Step 13: Print MAX

STEP 14: STOP

P a g e | 4

Flowchart of find largest second number algorithm

2. Characteristics algorithm

An algorithm would consist of the following components:

Input: Each algorithm needs a value to be entered (it can be more or less). Those are the values needed to execute the algorithm. For example, the algorithm I mentioned in "Example of algorithm", Input is 10 integers entered from the keyboard  Output: Each algorithm requires one or more outputs, also known as outcomes. These are the values that have a totally defined link with the input data and are the outcomes of the algorithm once all of the stages have been completed. For example, the algorithm I mentioned in "Example of algorithm", output is the second largest number in array

P a g e | 6

3.2. The entire SDLC process 3.2.1. Ideation and planning

The first step in SDLC is to come up with ideas, any project starts with ideas. Besides, having an idea is not enough, to be able to turn it into a project, we need to have a solid and specific plan. It is the core of software development, as it defines the scope of the project, defines the means and manner of implementation, and how to proceed and maintain to meet the stated goals and requirements.

3.2.2. Requirements gathering

In this phase of the process the software development project is defined in detail and the feasibility analysis of the project is carried out.

In this step we need the "Software Requirement Specification" document (SRS). It will help to synthesize everything necessary for software development and project life cycle such as: collecting all the necessary requirements of the project, analyzing factors that may affect the project (time, human resources, economic resources, etc.), establish the solutions needed in software development, etc.

3.2.3. Design and prototying

In this phase, the system of the program will be built in detail including screen layout, process diagram, pseudocode and other documents.

Also at this stage, SRS documents will be detailed screening and approval.

3.2.4. Software development

This stage can also be understood as the implementation phase of the program development. Once the required documents are approved, this phase will take advantage and proceed to write the actual code. This stage is also the one that lasts the longest because it is an extremely important step in SDLC.

3.2.5. Testing and integration

After the actual code has been completed, SDLC will proceed to the Testing and integration phase.

At this stage, inspection and testing will be performed as required. This is also an indispensable step of SDLC , because this will ensure the quality of the generated software.

Testing the features in the program can help detect errors and deal with them in a timely manner.

3.2.6. Implementation and deployment

After finishing the Testing and integration phase, the output software has reached the required quality, then it will go to the Implementation and deployment step.

The program at this stage will be final checked and released. In addition, this phase also has to track the problems when the software is deployed and find solutions to deal with them.

P a g e | 7

3.2.7. Operation and maintenance

The final phase of SDLC is Operation and maintenance. After the software is released, it will be regularly maintained and updated to ensure the software will operate stably and optimally.

During this period, the software will be increasingly upgraded and more complete.

Maintenance will help to find bugs which timely fixes ensure user experience. Moreover, the enhancement of the functions already and intended in the program according to the user's request will help the program grow stronger.

4. Represent a small and simple problem

To learn more about the algorithm and its details. I will apply an algorithm to solve a problem as follows: A library wants to manage books in the library. The library manager needs to print out all book entered, the books with the least quantity, and the books with the highest prices. The program needs a main menu based on requirements such as: Enter the book code, enter the title of the book, enter the number of books, enter the bookshelf

5. Analyze the problem

To solve the problem, I will use the C# programming language to create a program that can meet the needs of a library manager. In addition, I will apply the experience from "Procedural Programming", and use libraries, variables, expressions, loop statements, conditional statements, to solve this problem.

First, we need to define the Input and Output of this algorithm

Input: information of books to enter such as: book code, book title, quantity and price of the book

Output: Includes information of imported books, books with the least quantity, and the books with the highest price

Schematic summary of the algorithm's operation

P a g e | 9

6. Use-case diagram

P a g e | 10

7. Flowchart

7.1. Select menu funtionExplain:

Step 1: Begin Step 2: Declare variable option = 0 Step 3: Display menu

  1. Input book’s information to store in arrays
  2. Print all book’s information from arrays
  3. Print the most and the least book from quantity array
  4. Print the highest price book in price array
  5. Exit program Step 4: Input a option Step 5: Check option is 5 or not.
  • If it is 5, the program will be end
  • if it is not 5, the program back to display menu Step 6: End

P a g e | 12

7.3. Print book’s information

Explain:  i : index in array  n: number of book in program  code [ ]: the array of book’s code  name [ ]: the array of book’s name  quantity [ ]: the array of book’s quantity  price [ ]: the array of book’s price Step 1: Begin Step 2: Declare a variable: Opinion = 0, i = 0 Step3: Display menu contains options

Step 4: Input a option Step 5: Check option is 1 or not

  • If option is 2, go to step 7
  • If option is not 2, go to step 6 Step 6: Check option is 5 or not.
  • If it is 5, the program will be end
  • if it is not 5, the program back to display menu Step 7: Enter the number of book need to import Step 8: Check the condition of the number of book entering
  • If i < n go to step 9
  • If i >= n, the program will back to display menu Step 9: Print book’s information (code, name, quantity, price ) Step 10: import < i = will increment by one and will go to step 7 again until the condition of step 7 is no longer satisfied. Step 11: End

P a g e | 13

7.4. Print the most and the least quantity book