A Greenwich winform programming assignment received Merit points. Language C. This assignment will provide detailed reports about library management software, common c code syntax in C programming, APIE rules in objectoriented programming are all used.
Trang 1ASSIGNMENT 1 FRONT SHEET
Unit number and title Unit 1: Programming
Re-submission Date Date Received 2nd submission
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
Trang 3 Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
3.1
3.2
Trang 4Table 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
Trang 5Table 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
Trang 6A 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
Trang 7Figure 1: The sort algorithm
b Characteristics of algorithms:
Figure 2:Characteristics of algorithm
Trang 8+ 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
Trang 9Figure 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
Trang 10Figure 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
Trang 11Figure 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:
• Analyze the situation:
+ Create a userLogin to increase the security of the application
+ Create a list Of students
Trang 12+ 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
Trang 13Figure 9: Variables in my program
Statement:
Trang 14Figure 10: Statements in my program
2.2 Flowchart:
My program:
Trang 15Figure 11: Flowchart system of my program
Trang 16Find student’s information by name:
Figure 12:Find student’s information by name
Trang 17Bubble Sort:
I have a pseudocode that looks like this:
Figure 13: pseudocode bubble sort
Flowchart:
Trang 18Figure 14: flowchart bubble sort
Trang 192.3 A use case diagram for actions required:
Figure 15: use case my program
Trang 20D 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
Trang 213.2 Source code and a screenshot of the result final
Source code and explain
Picture 1: Class Student
• Initially, I created a Student class In the class I declare 8 properties including id,
FirstName, LastName, MidName, FullName, Address, Gpa, Major I create a Student constructor to create object with keyword new…
• In the properties, I use the access modifier:” public” so that other classes can access it I gave the first student the id GCH1000, and each subsequent student increases the id by 1 unit
• The next step: I build 5 methods: ReadPassword(), CreateStudent, SortByGpa,
FindByName, and ShowStudents
+ ReadPassword(): The purpose I built this function to print out the password hidden class with asterisks
Trang 22Picture 2: Method read Password
Trang 23+ CreateStudent: I call the student class built above to create the function to add students
Picture 3:Method to create a student
+ ShowStudents(): Iuse a for loop to print out the student array list
Trang 24Picture 4:Method to show list student + FindByName():
Trang 25Picture 5:Method to find student by name
I used a foreach loop and an if-else statement to build this function Check if the student's name to enter matches the student's name in the list, that student's information will be displayed
• I used the algorithm that I have analyzed and designed in task 2 to build function:
+ SortByGpa():
Trang 26Picture 6:Method to sort Gpa (Bubble sort)
I created a sub-method of type int Comparer() to compare the scores of two students
Then I use two nested for loops to survey from the top down and vice versa from the bottom up if students[j] > students[j-1] then swap places for these two students
Trang 29Picture 7: Method Main()
In the main method, I used the count variable to count the number of times when the wrong password is entered, if I enter the wrong password more than 3 times, the program will
automatically exit I used a do-while loop to help the selector re-enter the menu, while I use a switch statement to help the user choose the options corresponding to the menu in the switch cases I call the methods written above correspond to the menu
In my above code sources I used the import static "using static System.Console" to collapse my code
Trang 30Picture 8: Import static using static System.Console
Screen shots of the final result:
+ Enter UserLogin:
Picture 9: show userlogin on console
+ Enter student’s information:
Trang 31Picture 10: Enter student
+ Menu:
Picture 11:Show menu
Trang 32+ Sort students by grade ascending(Bubble Sort):
Picture 12:Sort gpa on console + Find student’s information by name:
Picture 13:find student's information by name on console
+ Show list of student:
Trang 33Picture 14:Show list student on console
+ Exit the program:
Picture 15: Exit program
3.3 Explain briefly what is Software Development Life Cycle
A software project's Software Development Life Cycle is a method that is followed It is a
comprehensive plan that specifies how to create, maintain, replace, and alter or improve certain software On the other side, it is a strategy for improving software quality and the development process as a whole
Figure 17: Software Development Life Cycle
Trang 34A Software Development Life Cycle includes the following stages:
+ Planning and requirement analysis: gathering important information from the problem and determining inputs, outputs, and the items required to solve it
+Design: Using the requirements analysis, create appropriate algorithms to address the problem
+Implementation: show how the algorithm is implemented using the appropriate programming language
+Testing: anticipate likely scenarios and conduct tests on the software; solve bugs (if any)
+Evolution: Improve and optimize the program by adding, eliminating, or implementing new algorithms
3.4 Explain how the source code is compiled
If the source code is to compile, it requires a tool known as a "compiler." The compiler's nature is
to translate high-level source code into intermediate code and then execute it quickly When you launch the compiler, it takes your code as input, processes it, and stores it as Intermediate Language (IL) code in *.exe or *.dll files A just-in-time (JIT) compiler is used to transform the IL code into machine code (sometimes called "native" code)
Figure 18: Example about how c# compiler works
Trang 35E Task 4 - Evaluate how the problem is solved from the designed algorithm to the execution program written
by a specific programming language (D1)
4.1 Test plan:
a) Test input:
Trang 36b) Test method
Trang 37c) Test algorithm
d) Overall evaluation of testing part
There are a total of 11 cases The test table provides an overview of the likely cases in the
program, and the clear details allow us to better understand the code and the program For example, in a table of input, specifically a menu choice, we can easily see the likely circumstances and determine whether they are entered as true or false
Furthermore, the user can easily see the results of each function as well as possible cases with their return data type When the program prints the student's ID along with their grades, the user can see the student's information More specifically, the user can view the statistics of the entire list sorted and can determine which students have the highest and lowest scores
Trang 384.2 Evaluate how the problem is solved from the designed algorithm to the execution program written by a specific programming language
+ It is well-known in computer graphics for its ability to detect and correct minor errors (such as
a two-element swap) in almost-sorted arrays with just linear complexity (2n), which is why I chose it for the student management application in my program
• In conclusion:
An algorithm is a set of steps that must be followed in order to solve a problem We can grasp the nature of the problem and the proper solution by analyzing and designing the algorithm However, because the computer cannot comprehend human language, we must write it in a programming language that compilers can compile in order for the computer to understand and run it To finish the job, the software will be developed using the specified algorithm As a result, when it comes to issue solutions, textual algorithms and code variants are inextricably linked
F Conclusion:
• C# is now one of the most used programming languages in the world, and it is becoming increasingly popular This report allows me to practice with it In this paper, I discussed the C# programming language, algorithms, and the Bubble Sort Using object-oriented programming,
I created a small tool programming for student management The problem's fundamental prerequisites were effectively given and implemented