Professional Documents
Culture Documents
Assignment 1 Front Sheet: Date Received 1st Submission
Assignment 1 Front Sheet: Date Received 1st Submission
Assignment 1 Front Sheet: Date Received 1st 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.
Grading grid
P1 M1 D1
❒ Summative Feedback: ❒ Resubmission Feedback:
2. Algorithm
2.1 What is algorithm?
-An algorithm is a step-by-step description of the solution to a problem
An algorithm must be:
Definite
Finite
Precise and Effective
Implementation independent.
-Algorithm is used a lot in life such as to compare, cash, or simply in mathematics, …
2.2 Characteristics of algorithms
-Input: An algorithm that has input values from a specified set.
- Output (Output): From each set of input values, the algorithm will generate output values. The output values are the solutions
of the problem.
- Stop calculation: After a finite number of steps the algorithm must stop.
- Determination: At each step, the operation steps must be very clear, not causing ambiguity. To be more specific, in the same
condition the two processors that perform the same step of the algorithm must give the same results.
- Correctness (efficiency): First of all, the algorithm needs to be correct, that is, after putting the data into operation algorithm
and giving the desired result.
- Popularity: The algorithm can solve any problem in the class of problems. Specifically, the algorithm may have different data
sets within a specific domain.
2.3 Example
Given two real numbers a and b. Please indicate the results comparing the two of them as "a greater than b", "a is less than b"
or "a equals b"
Step 1. If a> b, the result is "a greater than b" and go to Step 3
Step 2. If a <b, the result is "a less than b"; vice versa, the result is "a equals b"
Step 3. Finish algorithm
3. Problem
3.1 Business problem
As the management accountant salaries of everyone in the company. You need to accurately calculate wages that people
get every month.
Recipe:
Salary = salary 1 day * number of days + allowances
Find information with name or department.
Sort by salary.
3.2 Example
If Long is the manager in the company. He has 30 days took attendance with 1.200.000 vnd 1 day and 2.000.000 Money
allowance. He will have:
Long’s salary = 1.200.000 x 30 + 2.000.000= 38.000.000 vnd
4.1 Input/output
In put: Full name; department: use for find information
number day attendance; 1 day's salary: use for Payroll
Output: salary and Position.
explain:
-In h1, First, the data entered (a, b) will be taken to calculate the salary. Next, create i with j, assign the data entered in i
and j. then compare i; j. If i> = j, print the data assigned to i first then j. it will assign and compare to the end.
-In h2, First enter the name to search, then perform a scan of the data entered from the beginning to the end, if the same
name, data will exported to the screen. Perform a scan until there are no duplicate names. if not, it will print the "Name
does not exist."
That is enter number of member that you want for add data.
6.2 The idea, the algorithm needs to use, usability when put into practice:
The program helps payroll and find information faster. It helps save time for accountants. Methods of presentation and implementation
of algorithms is my experience has been accumulated during the study, however, the program still has many shortcomings, needs to be
developed in the future.
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace asm
int tam = 0;
bool check = false;
int count = 0;
Console.WriteLine("1. Search by name 2. Search by department \nEnter number: ");
tam = Convert.ToInt32(Console.ReadLine());
if (tam == 1)
{
string name;
Console.WriteLine("Enter name :");
name = Console.ReadLine();
foreach (member nv in AlistMember)
{
check = nv.SearchName(name);
if (check == true) count++;
}
if (count == 0) Console.WriteLine("Name does not exist");
}
else if (tam == 2)
{
string name;
Console.WriteLine("Enter department :");
name = Console.ReadLine();
foreach (member nv in AlistMember)
{
check = nv.SearchDepartment(name);
if (check == true) count++;
}
if (count == 0) Console.WriteLine(" Does not exist");
The code I used for find information with name or department. The first after input data and name want to find, the program will use
“bool check” to check the name in AlistMember. Then I make that scan data if name input is the same name in list, that true and print
to screen.
7.Test plan
Test key What is being How to test Data Expected Result Evaluate
test Result
2. http://kcntt.duytan.edu.vn/Home/ArticleDetail/vn/173/2859/cac-dac-trung-cua-thuat-toan
3. https://sites.google.com/site/bai5tubaitoandenchuongtrinh/4-mot-so-vi-du-ve-thuat-toan
4. https://www.google.com/