






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
assignment 1 đầy đủ nhất của môn 1618
Typology: Study Guides, Projects, Research
1 / 12
This page cannot be seen from the preview
Don't miss anything!







Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 1: Programming Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Phạm Minh Dũng Student ID GCH Class Assessor name 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 D
❒ Summative^ Feedback:^ ❒ Resubmission^ Feedback: Grade: Assessor Signature: Date: Lecturer Signature:
Algorithm is a set of instructions, used by computers, using programming languages such as C#, C/C++, JavaScript… to perform a computation. It takes input and give us output result. Algorithm is a finite sequence of well-defined instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing calculations and data processing. By making use of artificial intelligence, algorithms can perform automated deductions (referred to as automated reasoning) and use mathematical and logical tests to divert the code through various routes (referred to as automated decision-making).” Example of algorithm: Figure 1: Flowchart of an algorithm
The simple algorithm above is to calculate the greatest common divisor of two numbers a and b in locations named A and B. The algorithm proceeds by successive subtractions in two loops: IF the test B ≥ A yields "yes" or "true" (more accurately, the number b in location B is greater than or equal to the number a in location A) THEN, the algorithm specifies B ← B − A (meaning the number b − a replaces the old b). Similarly, IF A > B, THEN A ← A − B. The process terminates when (the contents of) B is 0, yielding the greatest common divisor in A. (Anon., n.d.) 1.2. Small problem needs to be solved using algorithm The problem I want to present is to determine if the user input numbers are odd or not. It can help the user to determine if the number is even or odd . Figure 2: Example of function
for loop if/else 2.2. Flowchart of the algorithm Figure 3: Flowchart of the program
3.1. How problem is solved To implement this algorithm, I use Visual Studio to make a console app with C# programming language. The program can take a list of students (names and grades) as input and output a sorted list. Figure 4: How the program solves the problem 3.2. Source code
Figure 5: Main menu hub The main menu hub in the program will have a do-while loop and switch-case. Its mission is to let users choose which options they want, with options from 0 to 8, in case users don’t insert the given numbers, the system will return to the main menu. Figure 6: Add student The “ThemsinhVien” option will require users to add student they want to add to the class. These are 9 types of data, including ID, Name, Sex, Age, Math, Physical, Chemistry, DiemTB, Hocluc. After that, the system will save inserted data and will appear in option 8, if you want to see it.
Figure 7: Display student information Now you can see, after entering the required information, the system will save your data and when you want to see your data, you can choose option 8 to have the system display the information you have entered Figure 8: Searching student by name The option “Search student by name” will be tackled when you want to find the name of the student, the system will find the information that you enter previous time, if your searching data is equal to the system data, the result will appear. Figure 9: Searching student by ID