Assignment 1
Assignment 1
problem
1
ASSIGNMENT 1 FRONT SHEET
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.
Grading grid
P1 P2 P3 M1 M2 D1
2
Summative Feedback: Resubmission Feedback:
3
Assignment Brief 1 (RQF)
4
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.
5
Catalog
Assignment 1 : Analysis and Design a solution for procedural programming problem................... 1
ASSIGNMENT 1 FRONT SHEET........................................................................................................ 2
Assignment Brief 1 (RQF).......................................................................................................................4
P1 , M1...................................................................................................................................................... 7
1 Introduction :.........................................................................................................................................7
1.1 What is procedural programming ? ( P1 )....................................................................................7
1.2 Key Features of Procedural Programming ( M1 )........................................................................7
1.3 Application...................................................................................................................................7
2 Analyse :.................................................................................................................................................8
2.1 Data types.....................................................................................................................................8
2.2 Local variables and global :......................................................................................................... 8
2.4 Statements.................................................................................................................................... 8
P3, M2..................................................................................................................................................... 11
3 Design................................................................................................................................................... 11
3.1 What’s WBS.............................................................................................................................. 11
3.2 What’s flowchart ?..................................................................................................................... 12
D1.............................................................................................................................................................17
4 Evaluation............................................................................................................................................ 17
4.1 Overview my solution :..............................................................................................................17
4.2 Advantages and disadvantages :................................................................................................ 17
5 References............................................................................................................................................ 17
6
P1 , M1
1 Introduction :
Simply put, Procedural Programming involves writing down a list of instructions to tell the computer
what to do step by step to complete the task at hand.
1.3 Application
- Procedural programming languages break up the programming task into a number of procedures
(also sub-routines or functions). Each procedure carries out a specific task and is called from the main
program. The procedural approach is relatively easy to understand and is therefore often used when
first learning programming. It is also suitable for systems that are fairly straightforward and don’t
involve many different interacting sub-systems.
- Procedural programming is specific to calculating scientific and engineering uses. It is used for
calculations. It consists of a fluid movement throughout the program as it runs.
This is great for straightforward systems which don’t involve many different interacting sub-systems.
* Based on the scenario given above, the reason why procedural programming can be applied is :
- The above problem needs to use declared variables to work logically, step by step in a predefined
sequence, such as declaring, updating scores, having the option of scanning out students with highest
or lowest scores number. That makes procedural programming one of the best iterative style choices
over other programming styles like object-oriented programming and more.
7
P2
2 Analyse :
2.1 Data types
C divides the data into different groups which is the data type.
8
- Switch-case statement, switch statements function somewhat similarly to the if statement, exists in
most high-level imperative programming languages.
- Switch-case structures use to design a menu options for user to help them determined what
function in program they want to use. The switch case is used when we have multiple options and we
want to compared the input value with all the cases inside the switch..case block to execute different
options.
- The for statement lets you repeat a statement or compound statement a specified number of times.
The body of a for statement is executed zero or more times until an optional condition becomes false.
You can use optional expressions within the for statement to initialize and change values during
the for statement's execution. For helps us to display all student user add and find the students with
the highest and lowest scores. The initialization statement is executed three times.
- A while loop in C programming repeatedly executes a target statement as long as a given condition
is true.
Here, statements may be a single statement or a block of statements. The condition may be any
expression, and true is any nonzero value. The loop iterates while the condition is true.
When the condition becomes false, the program control passes to the line immediately following the
loop.
9
- A while loop in C programming repeatedly executes a target statement as long as a given condition is
true.
Here, statements may be a single statement or a block of statements. The condition may be any
expression, and true is any nonzero value. The loop iterates while the condition is true.
When the condition becomes false, the program control passes to the line immediately following the
loop.
- Unlike for and while loops, which test the loop condition at the top of the loop, the do-while loop in
C programming checks its condition at the bottom of the loop.
10
P3, M2
3 Design
3.1 What’s WBS
- Arcording to Wikipedia, “Use Case Diagram is a representation of a user's interaction with the
system that show the relationship between the use and the different use cases in which the user is
involved” (Anon.).
- The benefits of creating a WBS include: it defines and organizes the work required. it facilitates the
quick development of a schedule by allocating effort estimates to specific sections of the WBS. it can
be used to identify potential scope risks if it has a branch that is not well defined.
11
3.2 What’s flowchart ?
- A flowchart is a diagram that depicts a process, system or computer algorithm. They are widely used
in multiple fields to document, study, plan, improve and communicate often complex processes in
clear, easy-to-understand diagrams.
- A diagram that shows the structure of an organization and the relationships and relative ranks of its
parts and positions/jobs. The term is also used for similar diagrams, for example ones showing the
different elements of a field of knowledge or a group of languages
- The diagram above take the work of breaking down the pieces of work that the program needs to do
in an easy to understand, logical way by WBS
12
3.2.2 Flowchart the menu application :
- As I said above about using the switch-case statement to design the selection menu for the program
because in this case, the switch-case statement becomes very convenient in dividing the work into
many pieces. section, many choices (cases) for the program to work
13
- Flowchart above illustrate step-by-step how to input variables in to arrays using loop. First, we start
a loop that brings the input statement into the previously created information arrays until the
number of times the loop is equal to the number of students we need to enter the information.
- I give the first value in the array equals min, start the loop with conditional statement to find the
smaller value in the array, the loop will be stopped when the minimum value is found and print it
14
3.2.5 Find the student with highest grades :
- The same to the way to find the student with lowest grades, but with a little bit different with the
condition of the loop, find the greater value in the array then print it out ( Display on the screen ).
15
- I start a loop with a conditional statement that outputs the values in the arrays one by one until the
number of iterations equals the number of students.
16
D1
4 Evaluation
4.1 Overview my solution :
- Looking at the design direction, the way to solve the problem transmitted through the above
diagram is relatively acceptable, it is not perfect because in my opinion during the programming
phase there can be a lot of confusing problems. But my approach succeeds in solving the problem
relatively stable
- Procedural programming helps me to solve the problem relatively easily because it possesses basic
features such as the operation of the program in a top-down sequence, which makes it easy and
convenient to control the source of information. benefits in breaking down program parts into
functions to solve problems
- My program still missing a lot of things, it will be very inconvenient if this program is used for a class
with too many students, making the declaration take a lot of time. Your program can still be upgraded
such as creating accounts, passwords for users, storing personal information, notifications of each
account
5 References
17
Available at: https://en.wikipedia.org/wiki/Work_breakdown_structure
[Accessed 20 February 2022].
Career Karma. 2022. What is Procedural Programming, and When Should You Use It?. [online]
Available at: https://careerkarma.com/blog/procedural-
programming/#:~:text=When%20you%20use%20a%20procedural,from%20a%20top%2Ddown%20vie
w.
[Accessed 20 February 2022].
18