Tải bản đầy đủ (.pdf) (40 trang)

Assignment 1 1618 Programming (Merit) Greenwich

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.02 MB, 40 trang )

ASSIGNMENT 1 FRONT SHEET
Qualification

BTEC Level 5 HND Diploma in Computing

Unit number and title

Unit 1: Programming

Submission date

08/12/2022

Re-submission Date

Date Received 1st submission
Date Received 2nd submission

Student Name

Tran Duc Long

Student ID

GCH210562

Class

GCH1106

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
Grading grid
P1

M1

D1

Page 1 of 39


Page 2 of 39


 Summative Feedback:

 Resubmission Feedback:

3.1

3.2

3.3


Grade:

Assessor Signature:

Lecturer Signature:

Page 1 of 39

3.4

Date:


Table of Contents
A.

Introduction: .................................................................................................................................................................... 4

B. Task 1 - State your simple business problems to be solved (P1) ...................................................................... 4
1.1.

What is the algorithm? ......................................................................................................................................... 4

a.

Dentition:. ......................................................................................................................................... 4

b.

Characteristics of algorithms: ............................................................................................................. 5


1.2.

Represent a small and simple problem ......................................................................................................... 8

C. Task 2 - Analyse the problem and design the solutions by the use of suitable methods (P1) ................ 9
2.1 Analyse the problem: ................................................................................................................................................. 9
2.2 Flowchart: .................................................................................................................................................................... 12
2.3 A use case diagram for actions required: ......................................................................................................... 17
D. Task 3 - Demonstrate the compilation and running of a program (P1 – M1) ............................................ 18
3.1. Introduce how the problem is solved ....................................................................................................................... 18
3.2. Source code and a screenshot of the result final ................................................................................................... 19
Source code and explain .......................................................................................................................... 19
Screen shots of the final result:................................................................................................................ 28
3.3. Explain briefly what is Software Development Life Cycle..................................................................................... 31
3.4. Explain how the source code is compiled ................................................................................................................ 32
E. Task 4 - Evaluate how the problem is solved from the designed algorithm to the execution program
written by a specific programming language (D1) ................................................................................................... 33
4.1 Test plan: ...................................................................................................................................................................... 33
a) Test input: ........................................................................................................................................... 33
b) Test method........................................................................................................................................ 34
c) Test algorithm ..................................................................................................................................... 35
d) Overall evaluation of testing part ....................................................................................................... 35
4.2 Evaluate how the problem is solved from the designed algorithm to the execution program
written by a specific programming language ......................................................................................................... 36
F. Conclusion: .......................................................................................................................................................................... 36
Reference ................................................................................................................................................................................... 37

Page 2 of 39



Table of picture
Figure 1: The sort algorithm .......................................................................................................................................... 5
Figure 2:Characteristics of algorithm ............................................................................................................................ 5
Figure 3:Algorithm is clear from input to output .......................................................................................................... 6
Figure 4:Finiteness of algorithm .................................................................................................................................... 7
Figure 5:Using available resources to handle problems ............................................................................................... 7
Figure 6:Independent of algorithm ............................................................................................................................... 8
Figure 7:Sorting grade of student problem ................................................................................................................... 8
Figure 8:How the bubble sort algorithm works ............................................................................................................ 9
Figure 9: Variables in my program .............................................................................................................................. 11
Figure 10: Statements in my program ......................................................................................................................... 12
Figure 11: Flowchart system of my program............................................................................................................... 13
Figure 12:Find student’s information by name ........................................................................................................... 14
Figure 13: pseudocode bubble sort ............................................................................................................................. 15
Figure 14: flowchart bubble sort ................................................................................................................................. 16
Figure 15: use case my program.................................................................................................................................. 17
Figure 16:How my program solves problem ............................................................................................................... 18
Figure 17: Software Development Life Cycle .............................................................................................................. 31
Figure 18: Example about how c# compiler works ..................................................................................................... 32

Table of source code
Picture 1: Class Student ............................................................................................................................................... 19
Picture 2: Method read Password ............................................................................................................................... 20
Picture 3:Method to create a student ......................................................................................................................... 21
Picture 4:Method to show list student........................................................................................................................ 22
Picture 5:Method to find student by name................................................................................................................. 23
Picture 6:Method to sort Gpa (Bubble sort) ............................................................................................................... 24
Picture 7: Method Main() ............................................................................................................................................ 27
Picture 8: Import static using static System.Console .................................................................................................. 28

Picture 9: show userlogin on console .......................................................................................................................... 28
Picture 10: Enter student ............................................................................................................................................ 29
Picture 11:Show menu ................................................................................................................................................ 29
Picture 12:Sort gpa on console.................................................................................................................................... 30
Picture 13:find student's information by name on console ........................................................................................ 30
Picture 14:Show list student on console ..................................................................................................................... 31
Picture 15: Exit program .............................................................................................................................................. 31

Page 3 of 39


A. Introduction:
Everything in our current civilization is modern and inventive. Every day, there is a great deal
of innovation, particularly in technology. We must acknowledge that technology has invaded
every part of our life, from basic gadgets like phones and computers to complicated programming
programs.
In this assignment, I will talk about student mark management software, precisely how I can
use it, as well as extensive explanations of its features and characteristics, and ultimately an
evaluation of the functions and the overall program. In addition, I included four alternatives in my
application for users to choose from, each with its own purpose and information to allow them to
develop a range of programs. These capabilities will aid the user in entering student information
such as grade or name, as well as finding which students have the highest and lowest grades.

B. Task 1 - State your simple business problems to be
solved (P1)
1.1.

What is the algorithm?
a. Dentition: An algorithm is a process or formula for problem-solving. It comprises stages,
which are a series of operations performed in a certain order to get the intended result.

For example: The sort algorithm

Page 4 of 39


Figure 1: The sort algorithm
b. Characteristics of algorithms:

Figure 2:Characteristics of algorithm

Page 5 of 39


+ Unambiguous: The algorithm should be explicit and understandable. Each of its processes
(or stages), as well as its inputs and outputs, should be self-evident and lead to a single
meaning.

Figure 3:Algorithm is clear from input to output
+ Finiteness: Algorithms must terminate after a predetermined number of steps.

Page 6 of 39


Figure 4:Finiteness of algorithm
+ Feasibility: With the existing resources, it should be possible.

Figure 5:Using available resources to handle problems
+ Independent: An algorithm should have step-by-step instructions that are not dependent
on any computer code.


Page 7 of 39


Figure 6:Independent of algorithm

1.2.

Represent a small and simple problem


To understand algorithms in programming more clearly, I will depict a modest and easy
business challenge, which is sorting students by grades in ascending order. This is the
challenge that most teachers have while classifying students.

Figure 7:Sorting grade of student problem
I will use the bubble sort algorithm to solve this problem because it is easier than other
sorting techniques. The idea behind this technique is to sort a list of student grades by
repeatedly exchanging two consecutive values if they are in the wrong order (the latter
grade is less than the prior grade) until the sequence grades are entirely sorted by
ascending order.

Page 8 of 39


Figure 8:How the bubble sort algorithm works

C. Task 2 - Analyse the problem and design the
solutions by the use of suitable methods (P1)
2.1 Analyse the problem:



Scenario:
A simple program that assists teachers in creating a list of students complete with id, full
name, address, gpa, and major. This program allows instructors to access the information
of students with the highest and lowest scores by sorting a list of students by scores from
low to high. Teachers may also search student information by name.



Analyze the situation:
+ Create a userLogin to increase the security of the application.
+ Create a list Of students.

Page 9 of 39




+ Create a method that shows all students' information.
+ Create a method sort that shows students with the highest grade and lowest grade
(bubble sort).
+ Create a method that finds students' information by name.
+ Create a menu so that teacher can choose options.
• Discuss:
+ Today's programming languages are evolving swiftly and forcefully in the growth of
science, taking an important position in the disciplines of science and technology.
The use of information technology in student administration is very popular.
+ We need to undertake a variety of duties and tasks in order to implement the
student management program. As a result, an object-oriented programming
program can assist in the design of this program. Functions and tasks can be

readily implemented using functions (or custom). Furthermore, the functional
abstraction (or specialization) of OOP makes it simple for programmers to create
programs and simple for users to utilize.
+ The usage of loops will assist users in rapidly and effectively locating student
scores or searching for personal information about students. In addition, teachers
can also see the students with the highest and lowest scores through the sorted
list of students, this will be much faster than before we had to find each page to
find information.
Implementation:
I will use C# for analysis but the algorithm I mentioned above.
➢ In my project, I use variables and statements the following:
➢ Variable

Page 10 of 39


Figure 9: Variables in my program
Statement:

Page 11 of 39


Figure 10: Statements in my program

2.2 Flowchart:
My program:

Page 12 of 39



Figure 11: Flowchart system of my program

Page 13 of 39


Find student’s information by name:

Figure 12:Find student’s information by name

Page 14 of 39


Bubble Sort:
I have a pseudocode that looks like this:

Figure 13: pseudocode bubble sort
Flowchart:

Page 15 of 39


Figure 14: flowchart bubble sort

Page 16 of 39


2.3 A use case diagram for actions required:

Figure 15: use case my program


Page 17 of 39


D. Task 3 - Demonstrate the compilation and running of
a program (P1 – M1)
3.1. Introduce how the problem is solved
In my program, I apply object-oriented programing to divide this problem into small tasks that
include: 2 Class and 5 functions ReadPassword(), CreateStudent(), FindByName(), SortByGpa(),
and, ShowStudents(). In addition, I have used algorithm that were designed in task 2 to build
function SortByGpa(). These functions CreateStudent() and ShowStudents will support functions
FindByName() and SortByGpa(), EditGpa() in reading and displaying results.
In detail, my program will read unsorted list of students that included fullname, address, gpa, and
major from the keyboard, and then I display a menu. In menu have 4 options equivalent to 4
different functions sort, search, display, and exit program on the console screen. The user can
input choices with associated functionalities.

Figure 16:How my program solves problem

Page 18 of 39



×