How to write your own program, Study Guides, Projects, Research of Computer science

I will show you guys all steps in writing your own C program with result and also explain every single details for you to understand.

Typology: Study Guides, Projects, Research

2020/2021

Uploaded on 08/14/2023

ho-tri
ho-tri 🇨🇦

1 document

1 / 33

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification
BTEC Level 5 HND Diploma in Computing
Unit number and title
Prog102: Procedural Programming
Submission date
22/6/2022
Date Received 1st
submission
Re-submission Date
28/06/2022
Date Received 2nd
submission
Student Name
Nguyn Hi Vit
Student ID
GCD210136
Class
GED1101
Assessor name
Phm Thanh 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
Grading grid
P1
P2
P3
M1
M2
D1
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 How to write your own program and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Prog 102 : Procedural Programming Submission date 22/6/2022 Date Received 1st submission Re-submission Date 28/06/2022 Date Received 2nd submission Student Name Nguyễ n Hả i Việ t Student ID GCD Class GED1 101 Assessor name Phạ m Thanh 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 Grading grid P1 P2 P3 M1 M2 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Lecturer Signature:

I.introduction(P1,M1) We are in the twenty-first century, and the world is transitioning to the 4.0 technological era. Information technology is now widely used in everyday life, society, and the workplace. It distinguishes this industry from the rest. It also assists people in managing a variety of different aspects of their lives, such as school and industry. I shall introduce programming languages in this paper. In addition, I will offer a language for resolving user issues. I'll discuss the idea, how we use it, and how it works.

1. Secenario: 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

  • I.introduction(P1,M1) Table of Contents
      1. Secenario:
      1. OVERVIEW ABOUT PROGRAMMING LANGUAGES
      1. OVERVIEW ABOUT PROCEDURAL PROGRAMING
      • 3.1 PROCEDURAL PROGRAMING LANGUAGES
      • 3.2 KEY FACTORS OF PROCEDURAL PROGRAMING
      1. USER REQUIREMENT
  • II. SCENARIO ANALYSIS(P2).................................................................................................................
      1. UNIT INITIALIZATION
      • 1.1 Variables
      • 1.2 Data types
      • 1.3 Variables and data types in this program
      • 1.4 Condition statements
      • 1.5 Loop statement...........................................................................................................................
      • 1.6 Functions....................................................................................................................................
  • III. DESIGN SYSTEM STRUCTURE(P3,M2)
      1. ALGOTHRIM
      1. FLOWCHART
      1. WORK BREAKDOWN STRUCTURE
  • IV. CONCLUSION(D1)
    1. REVIEW FLOWCHART
      1. EVALUATION
    • 2.1 EVALUATION BRIEF:
      • 2.2 EVALUATION OF PROCEDURAL PROGRAM
      • 2.3. EVALUAITON DIFFICULTIES
  • References:
  • Figure 1: scenario......................................................................................................................................
  • Figure 2: The popularity of programing language by PYPL ranking
  • Figure 3: The popularity of programing language by TIOBE ranking
  • Figure 4: The popularity of programing language by Github ranking
  • Figure 5: Feature of C language
  • Figure 6: Simulaiton Procedural Programming
  • Figure 7: predefined function example.....................................................................................................
  • Figure 8: Example of global variable & local variable
  • Figure 9: Parameter passing example
  • Figure 10: Data types
  • Figure 11: Variable name and data types
  • Figure 12: Flow diagram of If statement
  • Figure 13: Flowchart of If-else
  • Figure 14: Flowchart of Else If statement
  • Figure 15: Flowchart of switch case
  • Figure 16: For loop flowchart
  • Figure 17: Do while loop flowchart
  • Figure 18: while loop flowchart
  • Figure 19: Function
  • Figure 20: Types of function
  • Figure 21: Use-Case
  • Figure 22: Flowchart of program..............................................................................................................
  • Figure 23: Flowchart of enterStudentsInfor
  • Figure 24: Flowchart of printstudent informaiton
  • Figure 25: Flowchart of higheststudent
  • Figure 26: Flowchart of lowest student
  • Figure 27: WBS of program
  • Figure 2 : The popularity of programing language by PYPL ranking
  • Figure 3 : The popularity of programing language by TIOBE ranking

point. Dividing a program into functions allows many people to participate in the program's construction. Figure 6 : Simulaiton Procedural Programming 3.2 KEY FACTORS OF PROCEDURAL PROGRAMING

  • Predefined functions: A predefined function is typically an instruction identified by a name. Usually, the predefined functions are built into higher-level programming languages, but they are derived from the library or the registry, rather than the program. One example of a pre-defined

function is ‘charAt()’, which searches for a character position in a string. Figure 7 : predefined function example

  • Local Variable : A local variable is a variable that is declared in the main structure of a method and is limited to the local scope it is given. The local variable can only be used in the method it is defined in, and if it were to be used outside the defined method, the code will cease to work.
  • Global Variable : A global variable is a variable which is declared outside every other function defined in the code. Due to this, global variables can be used in all functions, unlike a local variable.

Figure 9 : Parameter passing example

4. USER REQUIREMENT

  • Enter student IDs, student’s grades and store these information into 2 separate arrays (integer array for IDs and float array for grades).
  • Print all student IDs together with their grades.
  • Print highest grade and lowest grade.
  • Menu based with the options above, The program will return to the main program when the program ends.
  • Option to quit program. => Use C programming language to make a programing can solve the problem from a teacher. II. SCENARIO ANALYSIS(P2) 1. UNIT INITIALIZATION 1.1 Variables Variables in C languages are used to store different forms of data. It acts as a memory card where it saves all the data and used it during program execution. There are different types of variables in C; according to their types, the amount of memory or storage space it requires differs. As we said, variables

in C are storage used to hold the value. Data that variables can be different like int, float, char, double, etc. All the code or program depends on the variables as it describes the type of data for execution. 1.2 Data types Data types in c refer to an extensive system used for declaring variables or functions of different types. The type of a variable determines how much space it occupies in storage and how the bit pattern stored is interpreted. Figure 10 : Data types

  • Integer data type(int): it can have a range of numbers based upon the size you choose in memory, and it can have either all positive or from negative to positive range of numbers based upon user choice of code design.
  • Float data type: Any real number can be stored in the float data type, and here also we can specify the range.
  • Char type: This represents the character data type, and it can be either signed or unsigned with a constant size of 1 byte for both cases.
  • Void type: it won’t return anything like you saw the main function prefixed with void type in the above snippets
  • Arrays: When any homogenous set of data has to be stored in contiguous memory locations, then this data type is chosen, the use case is that there may be times when your code would return more than one result, and that has to be returned from functions cumulatively

Figure 12 : Flow diagram of If statement

  • if else statements: If else Statement in C programming language, when we need to execute a block of statements that too when a particular condition is met or not met that situation is known as decision making. In C programming, the decision-making process is used to specify certain orders in which statements are executed. I use if-else statement to check the condition of the data that I enter.

Figure 13 : Flowchart of If-else *Else If statement: When there are numerous criteria, the else-if statement is used to run the program. It is known as a multi-decision statement, and an else if statement and an else statement are placed after it.

Figure 15 : Flowchart of switch case 1.5 Loop statement

  • Definition: Loops in C programming language is a conditional concept used for consecutively executing a line or a block of code over and over again until it reaches the value desired by the programmer. In C programming, there are three types of loops, namely For Loop, While Loop and Do While Loop.
  • For loop: Infinite loops can be a series of instructions that can be carried out forever. These types of loop happen whenever there simply no terminating condition offered or possibly a terminating condition that could never be fulfilled (just like 1==2 and so on.) or maybe occasionally due to a run time error. I used it to run the loop program "i" to do the reading of the input data and i used it to run for loops looking for similar values like: MaxGrade, MaxID,...

Figure 16 : For loop flowchart

  • Do while loop: but DO WHILE loops execute the Program Statements first then the condition will be checked next. DO WHILE will execute the program at first even if the condition is valid/un- appropriate/False at first. Because the input values are most likely incorrect, I used it to double check and in the MenuOption I use it to run and double check the cases in it.