Docsity

Procedural Programming in Computing, Assignments of Web Design and Development

Partial preview of the text

Download Procedural Programming in Computing and more Assignments Web Design and Development in PDF only on Docsity!

Higher Nationals in Computing

Unit 0: Procedural Programming

ASSIGNMENT 1

Learner’s name: Nguyễn Thành Thông

ID: GCS

Class: GCS1005A

Subject code: PROG

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 0: IT Fundamental & Procedural Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Nguyễn Thành Thông Student ID GCS

Class GCS1005A 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 P2 P3 M1 M2 D

ASSIGNMENT 1 BRIEF Unit Number and Title Unit 0: IT Fundamental & Procedural Programming Academic Year 2021 Unit Tutor Assignment Title Assignment 1: Analysis and Design a solution for procedural programming problem Issue Date Submission Date IV Name & Date Learning Outcomes and Assessment Criteria Pass Merit Distinction LO1 Understand the principles of procedural programming LO2 Be able to design procedural programming solutions P1 Provide an introduction to procedural programming M1 Discuss on characteristics and features of procedural programming D 1 Critically evaluate the design of your solution against the characteristics and features of procedural programming. P2 Identify the program units and data and file structures required to implement a given design M2 Review the design of a procedural programming solution. P3. Design a procedural programming solution for a given problem Assignment Brief Scenario: A math teacher wants to manage grades of a class. He asks you to help him to write a small application to do that. He needs to enter student IDs, student’s grades and store these information into 2 separate arrays

(integer array for IDs and float array for grades). Then he needs to print all student IDs together with their grades. Finally, he needs to know which student has highest grade and lowest grade. Your program should be menu based with the options above. When an option is done, the program should go back to the main menu so he can choose another option. There should be an option to quit program. Task 1 To prove your programming ability to be appointed to this small project, please prepare an illustrated guide on programming in general and a particular emphasis on procedural programming. Here you will need to include introduction to computer programming languages and discuss key features of procedural programming. Task 2 Your next task is to do the analysis for the scenario mentioned above by doing the following subtasks

  • Identify the variables and data types required in the program.
  • Identify and describe 2 different selection structures, including the condition(s) to check; state why they are needed and where they can be used in the context of the scenario.
  • Identify and describe any iteration constructs.
  • Split the program into functions (sub-functions) and draw a hierarchy diagram to illustrate the structure of your program. Task 3 You need to use a drawing tool to draw design diagram for your program, includes:
  • A use case diagram for actions required
  • Flow chart diagrams for: menu operation, printing IDs and grades, finding max grade and finding min grade.
  • Review / evaluate your design, state clearly pros vs cons and which needs to improve, using characteristics of procedural programming as bases to discuss. Write a report for 3 tasks above and submit the report to CMS in PDF format. Submission 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.

P a g e | **1 ASSIGNMENT 1 ANSWERS P1. Provide an introduction to procedural programming

  1. Introduction to computer programming languages 1.1 Definition**
  • A programming language is a form of computer language that is used to write software, scripts, or instructions for the computer to follow. Programming languages are one kind of computer language and are used in computer programming to implement algorithms. Example: C, C++, C#, Java, JavaScript, Python, HTML, Pascal, etc

P a g e | 3

3. Criteria to select a programming language to use

  • No single language is the best choice for any given project. Although preference might be given to certain factors like performance, security in enterprise applications, fewer lines of code among other factors. For personal projects, the selection of a programming language may be as simple as picking a personal favorite. The right selection of a programming language yields solutions that are concise, easy to debug, easy to extend, easy to document, and easy to fix.
  • Type of application. Web applications, mobile applications, embedded firmware, etc.... P2. Identify the program units and data and file structures required to implement a **given design
  1. Variables**

1.1 Definition

  • Variable is basically nothing but the name of a memory location that we use for storing data. We

can change the value of a variable in C or any other language, and we can also reuse it multiple

times

1 .2 Rules for naming a variable

  • A variable name can only have letters (both uppercase and lowercase letters), digits and underscore.

P a g e | 4

The first letter of a variable should be either a letter or an underscore.

There is no rule on how long a variable name (identifier) can be. However, you may run into problems

in some compilers if the variable name is long than 31 characters.

Examples

2. Data types

2.1 Definition

C data types are defined as the data storage format that a variable can store a data to perform a

specific operation.

2 .2 Types of data types in C

Sr.No. Type & Description

1 Char

Typically a single octet(one byte). It is an integer type

2 Int

The most natural size of integer for the machine

3 Float

A single-precision floating point value

4 Double

A double-precision floating point value

5 Void

Represents the absence of type.

P a g e | 6 3 .2 If .. else

3 .2.1 Syntax

3 .2.2 Example

  • Unit 0: Procedural Programming ASSIGNMENT Table of Contents
  • P1. Provide an introduction to procedural programming
    • 1 Introduction to computer programming languages
      • 1.1 Definition
      • 1.2 High level programming
      • 1.3 Low level programming
      1. Introduction to procedural programming
      • 2.1 Definition
        1. 2 Introduction to C programming language
  • P2. Identify the program units and data and file structures required to implement a given design
      1. Variables
      • 1.1 Definition
      • 1 .2 Rules for naming a variable
    • 2 Data types
      • 2.1 Definition
      • 2 .2 Types of data types in C
    • 3 Selection structures (Conditional Statements)
      • 3 .1 If statement
      • 3 .2 If else
      • 3 .3 If else if
      • 3 .4 Switch case
    • 4 Iteration structures
      • 4 .1 For statement
      • 4 .2 While statement
      • 4 .3 Do while statement
    • 5 External modules
      • 5.1 Stdio.h library.
      • 5 .1.1 Printf
      • 5.1.2 Scanf
      • 5.3 Math.h library............................................................................................................................................................
    • P3. Design a procedural programming solution for a given problem
      • 1 Requirement for the given scenario:
      • 2 .Use case diagrams
    • 3 Flowcharts - 4.1. Input id and grade 4. Pseudo code
      • 4.2. Show IDs and Grades
      • 4.3. Print highest grade
      • 4.4. Print lowest grade
  • REFERENCES
  • P a g e |

P a g e | 9

3 .4 Switch case

4. Iteration structures

4 .1 For statement

4 .1.1 Syntax

P a g e | 10

4 .1.2 Example

4 .2 While statement

4 .2.1 Syntax

P a g e | 12

4 .3.2 Example

5. External modules

5.1 Stdio.h library.

  • #include in your c program, it will include stdio.h file into our source program which has the information for all input, output related functions. #include is a preprocessor directory. It will include the file which is given within the angle brackets "<>" into the current source file.

P a g e | 13

5 .1.1 Printf

  • In C programming, printf() is one of the main output function. The function sends formatted output

to the screen

Example:

5.1.2 Scanf

  • In C programming, scanf() is one of the commonly used function to take input from the

user. The scanf() function reads formatted input from the standard input such as

keyboards.

Example: