PROG102 - Assignment 1, Essays (university) of C programming

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 this 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 progra

Typology: Essays (university)

2022/2023

Uploaded on 02/19/2023

trinh-nguyen-phuong-fgw-hn
trinh-nguyen-phuong-fgw-hn 🇻🇳

4.8

(4)

10 documents

1 / 16

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
Date Received 1st
submission
Re-submission Date
Date Received 2nd submission
Student Name
Trinh Nguyen Phuong
Student ID
GCH210876
Class
GCH1108
Assessor name
Pham Danh Tuyen
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
PHUONG
Grading grid
P1
P2
P3
M1
M2
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download PROG102 - Assignment 1 and more Essays (university) C programming 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 Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Trinh Nguyen Phuong Student ID GCH

Class GCH1108 Assessor name Pham Danh Tuyen

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 PHUONG

Grading grid

P1 P2 P3 M1 M2 D

r Summative Feedback: Resubmission Feedback:

Grade: Assessor Signature: Date:

Lecturer Signature:

A. Introduction:

I. Introduction to Computer Programming Languages:

1. Definition:

Figure 1 - Computer Programming Languages

  • Writing instructions for a computer to carry out one or more tasks The unique languages created for programmers are referred to as programming languages. It provides a list of coding recommendations to assist programmers in developing rules for carrying out computer operations. Each programming language has its own set of rules. (Anon., 2021)

2. Classification of Programming Languages:

  • High-level Languages:
    • It is the programming language with powerful abstraction which gets from software information. When the programmers use these applications, they can generate the program without permission of detailed layout of the particular machine which runs its program.
    • It means that the programmers do not need to study computer design and take notice of solving the problems. Due to this, they are also called Problem-Oriented Languages.
    • Examples: C, C++, JAVA… (Anon., 2009)
  • Low-level Languages:
    • It is the programming language with non-powerful abstraction. The programmers need to study carefully about computer design due to deep understanding of computer layout that for composing the program for such a computer.
  • Not like High-level Languages, the Low-level less popular than High-level Languages.
  • Examples: Assembly Language, Machine Language… (Anon., 2009)

Figure 2 - High-level & Low-level Languages

3. Some Computer Programming Languages:

Figure 3 - C Language

Figure 5 - Procedural Programming

B. Identify the program units, data and file

structures:

I. Identify the variables and data types required in the program:

Variable’s

name

Data

type

Explanation

grades [50] float Its performances grade

of students.

I choose float because

it includes real

numbers.

IDs [50] int It shows ID of students.

I choose int because it

consists of only integers.

max/min float It^ declares the biggest

and smallest mark.

I choose float because it

includes both integers and

real numbers.

maxID, minID int It shows the ID of student

who has biggest or smallest

mark.

I choose int because it

consists of integers only.

choice int It reports option that

user chooses.

I choose int because it can

be integers only.

i, j int They^ are^ used^ in^ loop

function and be numeral

number in array function,

I choose int because it can

only be integers.

n int It declares the total number

of students.

I choose int because it

cannot be real numbers.

Table 1 - Table of Variables

II. Conditional statements needed in the problem

1. “Switch case” statement function:

  • It is used where the expression is evaluated results in multiple values. And in my report, I use it to create multiple options which users choose to report and use in “Menu options”. 2 is to print them on the screen.

Figure 6 - Code example of “Switch case”

  • With this function, my program can have more functions that users need to do with their information, such as finding the highest mark and who has that.

2. “If” statement function:

  • It allows us to make a decision in the program. Moreover, it lets program to test conditions and make decision about which code block to be executed. In my program, “if” statement is used to find the highest or the lowest mark in memory that users have already inputted. Example:

Figure 7 - Code example of “If”

  • In this example, min is known as the lowest mark that we need to find out. If min is higher than one element (the condition is true), min will get a new value and this new value is equal to that element.
  • In this example, “Do… while” statement persuades users enter input number of students. If users enter a character, the condition is true (Check Num(n) is function that checks input as an integer and this condition is check input as not an integer) and this statement still happens. It means that users have to enter input again and again until their input is an integer.

Figure 10 - Code example of "While"

  • In this example, n is the number of students. The program will print each student to the screen, one student each time. If number of students is zero, iteration constructs will be exited and end this function (n is inputted from user).

C. Design

I. WBS:

Diagram 1 - Use case Diagram

II. Flowcharts:

Diagram 3 - Display student’s information Flowchart

Step 1: Start.

Step 2: Declare float grades [50], int IDs [50], n, i=0.

Step 3: Check the condition “i < n”:

If false, the task will end.

If true, go to step 4.

Step 4: Print IDs and grades to the screen.

Step 5: Increment I by +1 and repeat step 3.

Diagram 4 - Find highest grade Flowchart

Step 1: Start.

Step 2: Declare float grades [50], int IDs [50], i, maxID, max.

Step 3: Check the condition “i < n”:

If false, print max to the screen.

If true, go to step 4.

Step 4: Check the condition “max < grades[i]”:

If true, set max = grades[i] and go to step 5

If false, go straight to step 5.

Step 5: Increment i by +1 then repeat step 3.

Step 6: End.

D. Reference

Anon., 2021. Guru99. [Online] Available at: https://www.guru99.com/computerprogrammingtutorial.html [Accessed 2 12 2023]. Anon., 2009. java point. [Online] Available at: https://www.javatpoint.com/classification-of-programming-languages [Accessed 2 12 2023]. Tanaka, 2012. Techopedia. [Online] Available at: https://www.techopedia.com/definition/21481/procedural-programming [Accessed 2 12 2021]. Matty, n.d. Google Sites. [Online] Available at: https://sites.google.com/site/mattysassignments/home/p1 [Accessed 2 12 2021]. Wang.S, 2020. Coursef. [Online] Available at: https://www.coursef.com/procedural-programming-characteristics [Accessed 2 12 2021].