















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
D task has something wrong, fix it if u wanna get the D grade!
Typology: Assignments
1 / 23
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 Student ID 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
Grade: Assessor Signature: Date: Lecturer Signature:
Chapter 1: State your business problems to be solved (P)
1. Definition of algorithms Figure 1 : What is an algorithm ➢ An algorithm is a finite sequence of well-defined instructions, typically used to solve a class of specific problems or to perform a computation. (Wikipedia, 2021) ➢ In my opinion, an algorithm is a map containing paths (algorithms) that help us get to our destination. 2. Characteristic of algorithm ➢ An algorithm must possess following characteristics: - Definiteness: Each step must be precisely defined; the actions to be carried out must be rigorously and unambiguously specified for each case. - Finiteness: The algorithm must always terminate after a finite number of steps. - Precise and Effective: All operations to be performed must be suffciently basic that they can be done exactly and in finite length. - Implementation indpendent: An algorithm should have step-by-step directions, which should be independent of any programming code. (FPT Greenwich, 2021)
➢ Purpose: Program is written to calculate “x” in a first-order equation. ➢ Algorithm: Using 2 conditional statements:
➢ The chapter must deal with 3 conditions:
There must also be an additional message if the equation has no solution or has infinitely many solutions. No Variable Data type Description 1 x float This variable stores the result of the 1st^ degree equation (ax + b = 0) with x = - b / a
x = - b / a if a ≠ 0. The equation has no solution when a = b, b ≠ 0. The equation will have infinitely many solutions when a = b and b = 0.
values of numbers a and b of a first-degree equation. Next, the program will print a message to enter 2 number a, b and ask the user to enter two numbers. After the user enters two numbers a, b, it will do a comparison a. If a ≠ 0 then it will go in the false direction to calculate x with x = - b / a, then print out x and end the program. If a = 0 then it will go to true and do b comparison. If b ≠ 0, the message “The equation has no solution” will be displayed then end program. If b = 0, the message “The equation has a multitude of solutions” is displayed then end program.
Figure 4 : The code of my program
a. Start program Figure 5 : Enter a
➢ Explain: The program will display the form of equation for the user to recognize, in parallel, asking the user to enter the coefficient a. b. Enter 2 (with a = - 2) Figure 6 : Enter a = - 2 ➢ Explain: The program will store the value of the coefficient a in the variable a (Ex: a = - 2) ask the user to enter the value of coefficient b. c. Enter b (with b = 8) Figure 7 : Print x
➢ When the user enters a = 0 and b ≠ 0 (Ex: b = 3), the program will have infinite solution and print “This equation has no solution”.
Step-by-step process of C# compilation: ➢ Step 1: Write a C# code ➢ Step 2: Compile the code using a C# compiler ➢ Step 3: Now compiler checks if the code contains an error or not. If no error is found, then the compiler moves to the next step. Or if the compiler found errors, then it will immediately tell the developer that an error is found in the given line, so that the developer can correct them. After correcting the error when you again run the code the compiler again checks for the errors, if no error found then it will move to the next step or if an error is found then the compiler gives a message to the developer. In C# there are two types of errors:
➢ Step 6: Once the C# programs are compiled, they’re physically packaged into Assemblies. An assembly is a file that contains one or more namespaces and classes. As the number of classes and namespaces in program grow, it is physically separated by related namespaces into separate assemblies. Assemblies typically have the file extension .exe or .dll depending on whether they implement applications or libraries respectively, where EXE stands for Executable and DLL stands for Dynamic Link Library. An EXE (Executable) file represents a program that can be executed, and a DLL (Dynamic Link Library) file includes code (Ex: Library) that can be reused across different programs. ➢ Step 7: Now, the C# compiler returns the output of the given C# code (argha_C14, 2021) Figure 10 : Compilation process of C# code Chapter 4 – Evaluate how the problem is solved from the designed algorithm to the execution by a specific programming language. (D)
Verify that the message " The equation has a multitude of solution " is displayed when the user enters a = 0 and b = 0. Calculate the results of the first- order equation (ax
Verify that the program will give an error message and asks to re-enter when the user enters a letter a and b > 0. Calculate the results of the first-order equation (ax + b = 0) by x = - b / a
Verify that the program will have an error message and asks to re-enter when the user enters a > 0 and b is the letter. Calculate the results of the first-order equation (ax + b = 0) by x = - b / a
The program has an error message and asks to re-enter Back to part code and error message Fail
Verify that the program will have an error message and asks to re-enter when the user enters a = 0 and b is the letter. Calculate the results of the first-order equation (ax + b = 0) by x = - b / a
Verify that the results of the first order equation will be displayed correctly when the user enters a ≠ 0 and b = 0. Calculate the results of the first-order equation (ax + b = 0) by x = - b / a
Verify that the program will have an error message and asks to re-enter when the user enters a and b are the letter. Calculate the results of the first-order equation (ax + b = 0) by x = - b / a
➢ Test case 5 : ➢ Test case 6 : ➢ Test case 7 :
➢ Test case 8 : ➢ Test case 9 :