Assignment 1 Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
Assignment 1 Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date
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
❒ Summative Feedback: ❒ Resubmission Feedback:
Programming is the process of creating a tutorial that tells the computer how to perform a task. Setup can be done in a variety of
computer setup languages, such as JavaScript, Python, and C ++.
I. Definition of Algorithm
1. In math and computer science, an algorithm, also known as an algorithm, is a finite set of well-defined instructions that can be
performed with a computer, often to solve a problem class. problem or to perform a calculation. Algorithms are always clear
and used to specify the execution of calculations, data processing, automated inference, and other operations.
As an efficient method, an algorithm can be represented in a finite amount of space and time, and in a well-defined formal
language to compute a function. Starting from the initial state and the initial (possibly blank) input, instructions describe a
calculation that, when executed, proceeds through a finite number of well-defined successive states, finally creates "output"
and terminates in the final end state. The transition from one state to the next is not necessarily deterministic; Some
algorithms, called stochastic algorithms, incorporate random inputs.
2. It is a step-wise representation of a solution to a given problem, which makes it easy to understand.
An algorithm uses a definite procedure.
It is not dependent on any programming language, so it is easy to understand for anyone even without programming
knowledge.
3. Unambiguous − Algorithm should be clear and unambiguous. ...
Input − An algorithm should have 0 or more well-defined inputs.
Output − An algorithm should have 1 or more well-defined outputs, and should match the desired output.
4. Example 4: Write the first 100 natural number calculation algorithm
S = 0;
S1 = S + 1;
S2 = S1 + 2;
S3 = S2 + 3;
...
S100 = S99 + 100
Identify the problem:
Step 2. i ←← i + 1
: Conditional branching
: Direction solution
: Input
: Output
: Treatment / calculate / assigned
: Return
: Connection point
II.4 Evaluate the relationship between the written algorithm and code variant (D1)
IV. SCENARIO
1. Problem: Restaurant food management
2. Solution: Display restaurant information such as address, phone number, email, ... dish information such as: dishes, selling
prices, ingredients
3. Flowchart and algorithms of scenario
4. Coding, testing and result:
- Code
using System;
namespace Ass_2re__
{
class infoFood
{
private string Tenmonan { get; set; }
private string Thanhphanchinh { get; set; }
private string Thanhphanphu { get; set; }
private string Loaimonan { get; set; }
private string Gia { get; set; }
public infoFood() { }
public void CheckinfoFood()
{
Console.Write("---Menu---");
Console.WriteLine("------");
Console.WriteLine("Ten mon: ");
Tenmonan = Console.ReadLine();
Console.WriteLine("Thanh phan chinh: ");
Thanhphanchinh = Console.ReadLine();
Console.WriteLine("Thanh phan phu: ");
Thanhphanphu = Console.ReadLine();
Console.WriteLine("Loai mon an: ");
Loaimonan = Console.ReadLine();
Console.WriteLine("Gia: ");
Gia = Console.ReadLine();
}
public void ShowinfoDetail()
{
Console.WriteLine("Ten mon an la: " + Tenmonan);
Console.WriteLine("Thanh Phan chinh la: " + Thanhphanchinh);
Console.WriteLine("Thanh phan phu la: " + Thanhphanphu);
Console.WriteLine("Loai mon an: " + Loaimonan);
Console.WriteLine("Gia: " + Gia);
}
}
}