You are on page 1of 28

ASSIGNMENT 1 BRIEF

Unit Number and Title 20: Advance Programming

Academic Year 2021

Unit Tutor Nguyễn Văn Sơn

Assignment Title Assignment 1

Issue Date

Submission Date

IV Name & Date

Pass Merit Distinction

LO1 Examine the key components related to the


object-orientated programming paradigm,
analysing design pattern types

P1 Examine the M1 Determine a D1 Analyse the relationship


design pattern from between the object-orientated
characteristics of the
object-orientated each of the creational, paradigm and design patterns.
paradigm as well as the structural and
various class behavioural pattern
relationships. types.

LO2 Design a series of UML class diagrams

P2 Design and build M2 Define class D2 Define/refine class


class diagrams using a diagrams for specific diagrams derived from a given
UML tool. design patterns using code scenario using a UML tool.
a UML tool.

FRM03_Assignment brief_14.11.2012 Page 1


Scenario

You’ve just made a contract with FPT Academy International, and are
about to be appointed as a Project Leader for a group of programmers to
develop its Student Management System.

In this Student Management System, you are required to create an


application to store list of students and list of lecturers. Following
information are to be stored for each student:

- stdId: The student ID of the form like GTxxxxx or GCxxxxx (x: is a digit)
- stdName: Student name
- stdDoB: Student date of birth
- stdEmail: Student email
- stdAddress: Student address
- stdBatch: The batch (class) of the student

Following information are to be stored for each lecturer:


Specific
- lecId: Lecturer ID with 8 digits (fixed)
requirements
- lecName: Lecturer
(see Appendix for - lecDoB: Lecturer date of birth
assessment criteria - lecEmail: Lecturer email
and grade - lecAddress: Lecturer address
descriptors) - lecDept: Lecturer department (e.g., Computing, Business, etc)

This application will need to provide following functionalities via a menu

=======================

1. Manage Students
2. Manage Lecturers
3. Exit

=======================

Please choose:

When user selects 3, the program will exit.

When user selects 1, the program will display submenu for managing
students:

FRM03_Assignment brief_14.11.2012 Page 2


=======================

1. Add new student


2. View all students
3. Search students
4. Delete students
5. Update student
6. Back to main menu

=======================

Please choose:

When user selects 2, the program will display submenu for managing
lecturers:

=======================

1. Add new lecturer


2. View all lecturers
3. Search lecturers
4. Delete lecturers
5. Update lecturer
6. Back to main menu

=======================

Please choose:

For the submenu:

When user chooses 1, program will prompt user to input


student’s/lecturer’s information (specified previously). After that,
program will validate the input data and if they are all valid, program will
add a new student/lecturer to the current list of students/lecturers.
Program should inform to the user corresponding messages.

When user chooses 2, the program will list all the students/lecturers to
the screen, each student/lecturer in a row and student’s/lecturer’s data
fields are separated by ‘|’.

When user chooses 3, the program will ask user to input


student’s/lecturer’s name to search for, the user can just type part of the

FRM03_Assignment brief_14.11.2012 Page 3


name in order to search for complete student/lecturer information.

When user chooses 4, program will ask user to input student/lecturer id


to delete the student/lecturer with the specified id if it exists, otherwise,
it will display a message to inform users that the student/lecturer with
such id doesn’t exist.

When user chooses 5, program will first ask user to input


student/lecturer id to update, once inserted and a student/lecturer with
the inserted id exists, it will display current data for each field of the
student/lecturer and user can type in new data to update or just press
enter to keep the current data for the field.

When user chooses 6, program will back to the main menu.


Task 1
Produce a written, self-learning course for managers/senior developers
that explain the principles and features of OOP and that show how OOP
is good for code re-use. You can include appropriate sample Java code
where it aids your points and/or provides further clarification. Ensure
that any diagrams that are included have captions and are referenced in
the text.
Hint: You must include the following terms
- Object/Class,
- Abstraction,
- Encapsulation,
- Inheritance,
- Polymorphism (Overloading and Overriding),
- Abstract classes,
- Interfaces

Task 2
Problem Analysis, for the scenario above.
You need to produce a full design for the requirements given. The design
must include
- Use-case diagrams for the most important features;
- Class diagrams for all objects identified as well as class relationships.
- Pseudo-code for the Algorithms for the main functionalities (3

FRM03_Assignment brief_14.11.2012 Page 4


flowcharts for most complex functions).
Example code can be used to help clarify OOP features.

For the assignment assessments, you are required to:


Student guidelines 1. Produce a design in UML that fully utilizes OOP principles and
features. (Use case, class diagrams, collaboration diagrams etc.).

Submission
Students are expected to submit hard copy of assignment
requirements

FRM03_Assignment brief_14.11.2012 Page 5


Grade Descriptor
PASS criteria

LO Learning outcome AC In this assessment you will have the Task


(LO) opportunity to present evidence no.
that
shows you are able to:

LO1 Examine the key 1 Examine the characteristics of the 1


components related object-orientated paradigm as well
to the object- as the various class relationships.
orientated
programming
paradigm, analysing
design pattern types
LO2 Design a series of Design and build class diagrams
UML class diagrams using a UML tool.

In addition to the above PASS criteria, this assignment gives you the opportunity to submit
evidence in order to achieve the following MERIT and DISTINCTION grades
Indicative
Grade Descriptor Contextualization
characteristic/s
M1 Determine a design pattern from
each of the creational, structural and
behavioural pattern types.
M2 Define class diagrams for specific
design patterns using a UML tool.
D1 Analyse the relationship between
the object-orientated paradigm and
design patterns.
D2 Define/refine class diagrams derived
from a given code scenario using a
UML tool.

FRM03_Assignment brief_14.11.2012 Page 6


This brief has been verified as being fit for purpose

Internal
Signature Date
Verifier 1

Internal
Signature Date
Verifier 2

FRM03_Assignment brief_14.11.2012 Page 7


Contents
ASSIGNMENT 1 BRIEF ..................................................................................................................................... 1

Grade Descriptor ............................................................................................................................................ 6

PASS criteria ................................................................................................................................................... 6

P1. Provide an introduction to procedural programming: ............................................................................. 9

1. Introduction to computer programming languages. .............................................................................. 9

2. Introduction to procedural programming. ........................................................................................... 10

3. Key features of procedural programming............................................................................................. 10

P2. Identify the program units and data and file structures required to implement a given design ........... 11

1. The variables and data types required: ................................................................................................ 11

2. Selection structures .............................................................................................................................. 12

3. Iteration constructs............................................................................................................................... 14

4. External modules/ functions required: ................................................................................................. 16

P3. Design a procedural programming solution for a given problem........................................................... 18

1. Use case: ............................................................................................................................................... 18

2. Flowchart: ............................................................................................................................................. 18

3. Pseudo code .......................................................................................................................................... 22

M1 Discuss on characteristics and features of procedural programming: ................................................... 26

1. Characteristics and features of procedural programming language : .................................................. 26

M2 Review the design of a procedural programming solution: ................................................................... 26

1. Design of a procedural programming solution: .................................................................................... 26

FRM03_Assignment brief_14.11.2012 Page 8


ASSIGNMENT 1 ANSWERS

P1. Provide an introduction to procedural programming:

1. Introduction to computer programming languages.


1.1. Programming language is a form of computer language, used to develop software
programs, create computer programs aimed at computer control or describe algorithms
for others to read out.

1.2. The programming language is divided into two types: high-level programming languages
and low-level programming languages:

1.2.1. The high-level programming language is a language that is more abstract than the
language of the computer. It is possible to use natural language elements, which are
easier to use. Making the program development process simpler and relatively
easier to understand than a low-level language.

1.2.2. The low-level programming language is a programming language that is closely


related to computer hardware. The word ' low ' does not mean that this language is
inferior to high-level programming languages which means that its commands are
very close to the machine language.

1.2.2.1. The lower-level programming language is often divided into two


categories: the first and second generations.

1.2.2.1.1. The first generation programming language is machine code. It is


the only language that the processor can understand. Currently
programmers hardly ever write the program directly in the machine
language as it not only requires much attention to the details that a
higher-level language handles automatically but also requires
memorization and finds the numeric code for each directive used.

1.2.2.1.2. The second generation programming language is the Assembly

FRM03_Assignment brief_14.11.2012 Page 9


language. It is considered to be the second generation language because
although it is not machine language but programmers still have to
understand the architecture of the processor (such as the recorder and
the commands of the processor). Simple statements are translated
directly into the machine code.

2. Introduction to procedural programming.


2.1. Procedural programming is an analysis of a large (functional) program into functional
blocks or functions that are small enough for easy programming and testing, which are
specific to simple problems, to find out how to solve the problem in the form of clear
specific algorithms that are easily illustrated in the algorithm language. Top-down
programmable procedural programming language.

3. Key features of procedural programming


3.1. Local variables:

Local variables are a variable that can only be accessed within the specific
chunk/block of code that it was written in, not through the entire script of code(Like
a global variable) a local variable is declared to override the same variable name in
the larger scope.

3.2. Global variables:

A global variable is a variable that can be viewed throughout the entire program by
every other procedure taking place, it is also accessible by every other task running
in the program. The majority of times, a global variable is a static variable, whose
extent is the entire runtime of the program.

3.3. Parameter passing:

Parameter passing allows variable values to be passed through to the program


which will hadle it with a procedure.

3.4. Modularity:

FRM03_Assignment brief_14.11.2012 Page 10


Modularity is a software technique that shows that seperating the functionality into
indivdual, interchangeable modules, each which allows it to execute the specific thing it is
designed to to do. These all combine as different tasks to achieve an overall goal.
3.5. Procedures:
When you have procedures in programming, the program that has them in will follow the
procedures step by step, systematically. The program does exactly what it is told to do in
the order that has been set by the programmer.
3.6. Programming libraries:
Programming libraries are a collection of pre-built codes , routines, sub-routines, classes
and values which can be used at any time by the program and it's users.
3.7. Procedural programming paradigm:
Procedural programming is derived from structured programming. Procedures, also
known as methods, functions, routines or sub-routines, simply contain a series of
computantional steps to be carried out. Procedures cna be carried out during any point
of the program, sometimes other procedures can call out another procedure during it's
cycle of run.

P2. Identify the program units and data and file structures required to implement a given design

1. The variables and data types required:


1.1. Variables are used to store information to be referenced and
manipulated in a computer program. They also provide a way of
labeling data with a descriptive name, so our programs can be
understood more clearly by the reader and ourselves. It is helpful to
think of variables as containers that hold information. Their sole
purpose is to label and store data in memory. This data can then be
used throughout your program.
1.2. Data type is a collection of data groups with the same characteristics,
ways of storing and processing them on that data field. It is a signal to
the compiler to recognize the size of a variable (for example, int is 4

FRM03_Assignment brief_14.11.2012 Page 11


bytes, will be discussed later) and its capabilities (for example, an int
variable can only contain numbers). original). Is the core component of
a programming language.
1.2.1. It has 5 basic data types: int, float, double, char and void.
1.2.1.1. Int: Store integer data. Float: Store values containing
decimal places. Double: Stores values containing
decimal places. Char: Stores single character
information. Void: Nothing.

2. Selection structures
2.1. “IF” statement is has two basic forms: If – else and if - else if:
2.1.1. “If” conditional statement used to check the condition and
perform the processing corresponding to that condition. if the
condition is right, then it will do something and if condition is
wrong, do something else.

FRM03_Assignment brief_14.11.2012 Page 12


FRM03_Assignment brief_14.11.2012 Page 13
2.2. “Switch case” used in situations where the expression being evaluated
results in multiple values.

3. Iteration constructs
3.1. “For”: The for statement allows repeat work until conditions are wrong.
3.1.1. Form of for statement:

for(initialization; condition; increment / decrement){

//one or more statement;

FRM03_Assignment brief_14.11.2012 Page 14


3.2. “While” statement allows repeat job if expression in while true:
3.2.1. Form of while statement:

While(expression){

Statement ;

FRM03_Assignment brief_14.11.2012 Page 15


3.3. “Do-while” statement will execute the statement before checking the while
condition. If the condition is true then continue, if it is wrong then stop.
3.3.1. Form of Do – while:

Do{

// one or more statement;

}while (expression);

4. External modules/ functions required:

A function is a group of statements that together perform a task. Every C program has at least

one function, which is main(), and all the most trivial programs can define additional functions.

The function takes arguments and returns a value to the program that calls it. Some functions

are often used in programming:

4.1.1. The stdio.h function is a library call function.

4.1.2. The printf function is used for output and scanf is used for input.

FRM03_Assignment brief_14.11.2012 Page 16


4.1.3. Data declaration functions: char, int, double, float.

FRM03_Assignment brief_14.11.2012 Page 17


P3. Design a procedural programming solution for a given problem.

1. Use case:

2. Flowchart:
2.1 Select menu functions

FRM03_Assignment brief_14.11.2012 Page 18


2.2 Input student informations

FRM03_Assignment brief_14.11.2012 Page 19


2.3 Print all student information

FRM03_Assignment brief_14.11.2012 Page 20


2.4 Print hightest grade

2.5 Print lowest grade

FRM03_Assignment brief_14.11.2012 Page 21


3. Pseudo code
3.1 Select menu functions

FRM03_Assignment brief_14.11.2012 Page 22


3.2 Input student informations

FRM03_Assignment brief_14.11.2012 Page 23


3.3 Print all

student information
3.4 Print hightest grade

FRM03_Assignment brief_14.11.2012 Page 24


3.5 Print lowest grade

FRM03_Assignment brief_14.11.2012 Page 25


M1 Discuss on characteristics and features of procedural programming:

1. Characteristics and features of procedural programming language :

Procedural programming language helps the developer or


programmer to build large application programs in effective
manner with the help of divided into smaller program also
known as functions. In addition to build an effective
programming language developer implements the top down
approach. Procedural programming helps the programmer in
order to break down application program into a data structure,
variables and subroutine. Procedural programming languages or
code of instruction are executed very fast and required less
memory

M2 Review the design of a procedural programming solution:

1. Design of a procedural programming solution:

Requirements specification:

Input, output, processing, user interface, timescales for


development, data, file structures.

Program design:

Tools such as structure diagrams, data flow diagrams, entiry


relationship models, flow charts, pseudo code.

Technical documentation:

FRM03_Assignment brief_14.11.2012 Page 26


Language appropriate to design, flowchart, pseudo code,
structured English, action charts, data dictionary, class and
instance diagrams.

FRM03_Assignment brief_14.11.2012 Page 27


REFERENCES

 1. Codehub.vn, (2019). Ngôn Ngữ Lập Trình. [online] Available at:


https://www.codehub.vn/Thuat-Ngu-Lap-Trinh/Ngon-Ngu-Lap-Trinh [Accessed 5 June.
2020].
 2. Codehub.vn, (2018). Tìm hiểu về hằng và biến trong lập trình. [online] Available at:
https://www.codehub.vn/Tim-Hieu-Ve-Hang-va-Bien-Trong-Lap-Trinh [Accessed 6 June.
2020].
 3. Codehub.vn, (2018). Functional programming và Procedural programming khác nhau
như thế nào. [online] Available at: https://www.codehub.vn/Functional-Programming-va-
Procedural-Programming-Khac-Nhau-Nhu-The-Nao [Accessed 11 June. 2020].
 4. Codelearn.io, (2020). What are algorithsm?. [online] Available at:
https://codelearn.io/sharing/thuat-toan-la-gi-hoc-thuat-toan-lam-quai-gi [Accessed 11 June.
2020].
 5. Howkteam.vn, (2019). Ngôn ngữ bậc cao và ngôn ngữ bậc thấp. [online] Available at:
https://www.howkteam.vn/course/goc-lap-trinh-vien/ngon-ngu-bac-cao-va-ngon-ngu-
bac-thap-3936 [Accessed 5 June. 2020].

FRM03_Assignment brief_14.11.2012 Page 28

You might also like