1618-asm2-Mai Trần Nguyên Khôi-GBS190474
1618-asm2-Mai Trần Nguyên Khôi-GBS190474
1618-asm2-Mai Trần Nguyên Khôi-GBS190474
Submission Date:
Date:
Submission Format:
1
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.
Submission
● Students are compulsory to submit the assignment in due date and in a way requested by the
Tutor.
● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/.
● Remember to convert the word file into PDF file before the submission on CMS.
Note:
● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you
must reference your sources, using the Harvard style.
● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply
this requirement will result in a failed assignment.
Unit Learning Outcomes:
2
LO2 Explain the characteristics of procedural, object-oriented and event-driven programming, conduct
an analysis of a suitable Integrated Development Environment (IDE)
LO4 Determine the debugging process and explain the importance of a coding standard
Assignment Brief and Guidance:
Assignment scenario
Scenario: You have applied for a post as a trainee with a software development company and have been
invited for an interview. You have been passed the presentation to demonstrate your problem solving and
basic programming skills. Now you are given a more challenge task to create a fully working, secure
application that has been developed using an IDE and adheres to coding standards for a detailed business
problem.
Tasks
You will discuss a suitable problem with your mentor and list the user requirements before designing,
implementing (coding) and testing a solution. You will create a report that should include:
● Introduction to your program (list of requirements and screenshots of program)
● Explain some of programming paradigms. Evaluate why and how your program use these (or some
of) paradigms.
● Explain the common features of an IDE should have and evidence of how the IDE was used to manage
the development of your code.
● An evaluation of developing applications using an IDE versus developing an application without using
an IDE.
● An explanation and evaluation of the debugging process in the IDE used and how it helped with
development.
● An explanation and evaluation of coding standards used in your program and the benefits to
organisations of using them.
The working application produced must also be demonstrated together with the presentation.
Case Studies
You can choose one of following case studies to implement
3
Hotel Management System:
A Hotel Management System is a software built to handle all online hotel activities easily and safely. This
System will give the hotel management power and flexibility to manage the entire system from a single
online portal. The system allows the manager to keep track of all the available rooms in the system as
well as to book rooms and generate bills.
1. The system should support the booking of different room types like standard, deluxe, family suite,
etc.
2. Guests should be able to search the room inventory and book any available room.
3. The system should be able to retrieve information, such as who booked a particular room, or what
rooms were booked by a specific customer.
4
Library Management System
A Library Management System is a software built to handle the primary housekeeping functions of a
library. Libraries rely on library management systems to manage asset collections as well as relationships
with their members. Library management systems help libraries keep track of the books and their
checkouts, as well as members’ subscriptions and profiles.
Library management systems also involve maintaining the database for entering new books and
recording books that have been borrowed with their respective due dates.
1. Any library member should be able to search books by their title, author, subject category as well by
the publication date.
2. The system should be able to retrieve information like who took a particular book or what are the
books checked-out by a specific library member.
3. User can add books with its information such as: title, author, publication date, category etc and
update it
This system involves the scheduling of flights, air ticket reservations, flight cancellations, customer
support, and staff management. Daily flights updates can also be retrieved by using the system.
1. Customers should be able to search for flights for a given date and source/destination airport.
2. Customers should be able to reserve a ticket for any scheduled flight. Customers can also build a
5
multi-flight itinerary.
3. Users of the system can check flight schedules, their departure time, available seats, arrival time, and
other flight details.
4. The admin of the system can add new aircrafts, flights, and flight schedules. Admin can cancel any
pre-scheduled flight (all stakeholders will be notified).
6
4. The system should support the reservation of tables.
7
Learning Outcomes and Assessment Criteria (Assignment 2):
Learning Outcome Pass Merit Distinction
LO2 P2 Give explanations M2 Analyse the D2 Critically evaluate
of what procedural, common features that the source code of an
object-oriented and a developer has access application which
event-driven to in an IDE. implements the
paradigms are; their programming
characteristics and the paradigms, in terms of
relationship between the code structure and
them. characteristics.
LO3 P3 Write a program M3 Use the IDE to D3 Evaluate the use of
that implements an manage the an IDE for
algorithm using an development process development of
IDE. of the program. applications
contrasted with not
using an IDE.
LO4 P4 Explain the M4 Evaluate how the D4 Critically evaluate
debugging process debugging process can why a coding standard
and explain the be used to help is necessary in a team
debugging facilities develop more secure, as well as for the
available in the IDE. robust applications. individual.
P5 Outline the coding
standard you have
used in your code.
ASSIGNMENT 2 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 thatmaking a
false declaration is a form of malpractice.
Student’s signature
Grading grid
P2 P3 P4 P5 M2 M3 M4 D2 D3 D4
Summative Feedback: Resubmission Feedback:
Lecturer Signature:
Page 5
Task 1 – Introduction to your program
References
Page 6
Task 1 : Introduction to your program
In addition, there must be options for the user to add or remove students.
Hence, I have planned this program and implemented it as follows:
- I will write a program that addresses these client problems. A program can enter that information
and export it for the user to easily use.
- I will also make a menu so that they can choose from functions such as adding or deleting a
student's information and an option to exit the program.
- When running the program, a menu panel will be displayed for the user to choose from, and that
menu will be repeated until the user wants to exit the program and select the exit function in the
menu.
- To do those things, I have to write some proper functions and commands to do it.
Task 2 – Explain programming paradigms
- Procedural programming is a programming model based on dividing the program into small
Dividing the program into small functions for easy handling and management.
Page 8
- Object-oriented programming is an object-based programming method that forms the foundation
for building a program.
- Advantages and disadvantages:
Advantages:
hen changing the data structure of an object, you don’t need to change the source code of
other objects.
If you want to change the data structure of an object, you just change some of the
component functions.
You can reuse source code through inheritance.
Abstraction: Relevant data and methods are packaged into classes for easy management
and use.
Polymorphism: allows us to use the same word to mean different things in different
contexts.
Inheritance: is the process in which a class has properties, methods, and fields of another
class. Using inheritance helps information is managed in hierarchical order.
Encapsulation: helps bind data and operations of data together in a single unit. A class
adhere to this feature.
For simple programs, event-driven programming is often more complex and cumbersome
than batch programming.
The flow of the program is usually less logical and obvious.
- Characteristics of event-driven programming:
Events: events include mouse, keyboard and user interface, which events need to be
triggered in the program in order to happen, that means the user has to interact with an
object in the program.
Event Handlers: event handlers are a type of function or method that runs a specific action
when a specific event is triggered.
Page 10
Time-Driven: time-driven is a paradigm, it’s a code that runs on a time trigger, time-driven
can be a specific code that runs on a specific time
Service-Oriented: service-oriented is used to write programs that are made for services. It
does not slow down the computer as service-oriented only consume little of the computer
processing power.
- My mother is a math teacher. Previously he had to manage student grades manually. That means,
she had to record student scores in the notebooks. This is very inconvenient in management, for
example: When you want to remove a student from the list, she must cross it out. This will make
the listless aesthetic if she deletes too many students deleting. Therefore, she has had trouble
managing student grades, so she had me to write him a program for him to manage his students.
The program includes functions:
Adding student’s information into program. Including: student’s name, ID, exam score2 1,
Exit function.
- Diagram
Page 11
Page 12
- Flowchart
Class Menu
Page 13
Class ImformationManagement.
AddStudent () function
Page 14
PrintList () function
DeleteStudent () function
SaveList () function
Page 15
- Name class: Program.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASM2
{
class Program
{
static void Main(string[] args)
{
Menu m = new Menu();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASM2
{
class Menu
{
//constructor
public Menu()
Page 16 {
int choice;
InformationManagement sm = new InformationManagement();
do
{
Console.Clear();
Console.WriteLine("======MENU==============");
Console.WriteLine("= 1.Add new student =");
Console.WriteLine("= 2.View all student =");
Console.WriteLine("= 3.Delete student =");
Console.WriteLine("= 4.Save lits to file. =");
Console.WriteLine("= 5.Exit. =");
Console.WriteLine("========================");
Console.WriteLine("Please choose:");
choice = int.Parse(Console.ReadLine());
// I use switch-case to create a menu
switch (choice)
{
case 1: // if the user choose 1, the program will execute case 1
{
sm.AddStudent();
}
break;
case 2: // ifthe user choose 2, the program will execute case 2
{
sm.PrintList();
Page 17
}
break;
case 3: // if the user choose 3, the program will execute case 3
{
sm.DeleteStudent();
} break;
case 4: // if the user choose 4, the program will execute case 4
{
sm.SaveList();
}break;
case 5: break; // if user choose 5, the program will stop
default: Console.WriteLine("Invalid choice"); break; //If the user selects other
than 1 to 5, the program will execute default
}
Console.ReadKey();
} while (choice != 5); // if the user choosing 5, the loop will stop.
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace ASM2
{
class InformationManagement
{
Page 19
if (scoreExam2 > 10 || scoreExam2 < 0)
{
Console.WriteLine("Error!");
Console.Write("Please enter exam score 2 again:");
goto BeginLoop2;
}
Console.WriteLine("==============================================================================");
Console.WriteLine("Name ID Test1 Test2 Test3
Average ");
Console.WriteLine("==============================================================================");
}
sw.WriteLine("==============================================================================");
Page 21
sw.WriteLine("Name ID Test1 Test2 Test3
Average ");
sw.WriteLine("==============================================================================");
foreach (StudenInformationt b in liststudent)
{
sw.Write("{0} {1} {2} {3} {4}
{5}\n", b.Name, b.ID, b.Test1, b.Test2, b.Test3, b.Average);
}
sw.Flush(); // release the data.
sw.Close();
fs.Close(); // closse file text.
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ASM2
{
class InformationStudent
{
private string studentName;
private string studentID;
private float scoreExam1;
private float scoreExam2;
private float scoreExam3;
private float scoreAverage;
//constructor
public InformationStudent() { }
public InformationStudent(string name, string id, float test1, float test2, float
test3,float average)
Page 22
{
this.studentName = name;
this.studentID = id;
this.scoreExam1 = test1;
this.scoreExam2 = test2;
this.scoreExam3 = test3;
this.scoreAverage = average;
}
Page 23
}
public float Test2
{
get { return scoreExam2; }
set { scoreExam2 = value; }
}
public float Test3
{
get { return scoreExam3; }
set { scoreExam3 = value; }
}
public float Average
{
get { return scoreAverage; }
set { scoreAverage = value; }
}
}
}
Funciton (1):
- Input:
If user chooses 1, the screen will allow the user to enter information student.
Name: Nguyen Van A ID: 111 Exam score 1: 7 Exam score 2: 8 Exam score 3: 9
Name: Nguyen Van B ID: 222 Exam score 1: 6 Exam score 2: 5 Exam score 3: 7
Name: Nguyen Van C ID: 333 Exam score 1: 9 Exam score 2: 9 Exam score 3: 8
Page 24
Page 25
Function (2):
- Input:
- Output:
Function (3):
- Input:
Page26 + If user chooses 3, the screen will allow user enter position and display
as in the output.
The position he wants to delete: 2
- Output:
Page 27
Function (4):
- Input:
- Output:
+ File screen:
Page 18
Name: Nguyen Van A 111 7 8 9
Page 19
- Because I want my menu to run as soon as the program executes the line that uses to hail Menu class, I
use constructor and create a menu inside it.
- After the user enters the selection and the chapter makes that selection, the program will return to the
user entering another selection. Therefore, I use the do-while loop here. I want this loop will stop when
user choose 5. Therefore, condition of while is “choice” different 5. (“choice” is variable I declare and
use it to save user’s choosing).
- I use the switch-case conditional statement to execute user’s choosing:
delete function that is available when using the list to delete student’s
information.
Page 21
- SaveList() function: this function helps save list to file. I create a text file, then I use the foreach loop to
browse elements in the list and print them to the screen.
Debugger
- To set a breakpoint on a specific line of code click on the left margin of the IDE or press F9 to set
the breakpoint.
- When executing to the line of code set Breakpoint you will see an arrow in the red circle, this is
the code that will execute next.
If you want to keep track of the values of variables at that time. Visual
Page 20
Studio provides several ways as follows:
Page 21
- Locals Window: It helps display the value of local variables.
- Watch Window: Let's type the names of any variables or attributes that need to be checked.
- Autos Window: It helps appear variable values within a few lines of code before and after where
you are stopping.
In addition:
- Step Over (F10): Go to the next command.
- Step Into (F11): If the instruction pointer is in a function then the instruction pointer goes inside
the function and places the instruction pointer at the beginning of the code.
- Step Out (Shift + F11): Complete the execution of an existing method and stop the Debugger in
Page 22
the parent function.
Page 23
The debugger is a function that helps programmers find and
detect bugs. These bugs are found either by testing or by
users in the field. By finding errors, it is possible to enhance
the security of the program, through error correction.
- Compile and execute:
For ease of visualization, I will use an example of how to compile and execute the
program "Hello World"
- On the menu bar, choose File => New => Project.
- Click the Run button or press the F5 key to execute the project. On the screen will display
Command Prompt window with the words Hello World.
- Open Command Prompt and access the folder where you saved the file above.
- If there are no errors, Command prompt will create executable file helloworld.exe.
Coding standard:
- There are 3 common types of naming.
Page 24
Pascal case The first word of the identifier and the first PrintStudent
word of each subsequent word must be
capitalized. Use Pascal Case to name a
name with 3 or more characters.
Camel case The first word of the identifier is lowercase name
and the first word of the subsequent term
must be capitalized (if any).
Uppercase All characters in the identifier must be System.IO
capitalized. Use this rule for identifiers
with 2 or fewer characters
- Naming convention:
Page 25
Variable name Camel Case firstName
The variable name, the bool method, must be meaningful if they return true or false. Should use the
prefix "Is" "Can" "Has" before the variable name, method.
Do not create 2 namespaces of the same name and only differ in typography.
Do not use the same names that are only case sensitive.
- Declaring:
Declaring library
using System.Data;
using System.Drawing;
Declaring namespace
namespace SQLBackup
- Command-writing conventions:
- Source code:
Using the brace {} to highlight a block of source code. Each parenthesis is on one line.
Page 26
In if, for, foreach, and so on statements, if there is only one statement, there may be no need to
highlight the code block.
- White space:
Writing a tab space for commands that are in the block {}.
Writing a tab space for the statement immediately after if, else, while, for, foreach.
Page 27
Coding standard I used in my program:
- Naming convention:
Do not use the same names that are only case sensitive.
- Command-writing conventions:
- Source code:
Using the brace {} to highlight a block of source code. Each parenthesis is on one line.
In if, for, foreach, and so on statements, if there is only one statement, there may be no need to
highlight the code block.
- White space:
Writing a tab space for commands that are in the block {}.
Writing a tab space for the statement immediately after if, else, while, for, foreach.
Importance of source code: Whether you program individually or programmers with a team, it's
important to use code standards. Because:
Easy maintenance and error correction.
- Text editor: almost every IDE will have a text editor designed to write and manipulate source code.
- Debugger: debugging tools help users identify and fix errors in source code.
- Code completion: the complete features of the code assist programmers by smartly identifying and
inserting common code components. These features help developers save code time and reduce the
possibility of syntax errors.
- Programming language support: IDEs are usually specific to a programming language, although some
also offer multilingual support like the IDE Sublime Text. As such, the first step is to find out the
language you are using and select an appropriate IDE.
Page 29
References
1. Hackr.io. 2020. What Is Procedural Programming? [Definition] - Key Features. [online]
2. Viblo. 2020. Coding Conventions Trong C#. [online] Available at: https://viblo.asia/p/coding-conventions-
2020].
7. dzone.com. 2020. What Is Event-Driven Programming And Why Is It So Popular? - Dzone Cloud.
9. Viblo. 2020. Coding Conventions Trong C#. [online] Available at: https://viblo.asia/p/coding-conventions-
10. Slideshare.net. 2020. Coding Standard (Chuẩn Mã Nguồn). [online] Available at:
2020].
Page 30