SlideShare a Scribd company logo
1 of 39
Download to read offline
1
ASSIGNMENT 1 FRONT SHEET
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 NGUYEN THE CUONG Student ID BH00387
Class Assessor name DINH VAN DONG
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 Cuong
Grading grid
P1 M1 D1
1
❒ Summative Feedback:
❒ Resubmission Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
2
Table of Content
I. Introduction.................................................................................................................................................................4
II. Content...................................................................................................................................................................... 6
1.What is algorithm................................................................................................................................................6
1.1. For example.............................................................................................................................................7
1.2. Pose the problem of solving quadratic equations and draw flow diagrams........................................11
2. Steps in program development and explain....................................................................................................13
2.1. Problem Definition................................................................................................................................14
2.2. Problem Analysis...................................................................................................................................14
2.3. Algorithm Development........................................................................................................................15
2.4. Coding & Documentation......................................................................................................................16
2.5. Testing & Debugging.............................................................................................................................18
2.6. Maintenance......................................................................................................................................... 19
2.7. Introduction to Visual Studio................................................................................................................20
3. Solve real problems with algorithms............................................................................................................... 23
3.1 Problem of finding prime numbers in a given range............................................................................. 23
4. Workaround (M1)............................................................................................................................................ 25
5. Debug............................................................................................................................................................... 27
6. Test case...........................................................................................................................................................29
7. step by step from coding to running each program........................................................................................32
8. Check the algorithm implementation in C# language..................................................................................... 33
9. Evaluate the relationship between writing algorithms and using variables in the program.......................... 34
III. Conclusion...............................................................................................................................................................36
IV. Reference list.......................................................................................................................................................... 38
3
Table of figures
Figure 1 . Algorithms..............................................................................................................................................6
Figure 2 . Prepare the ingredients for the cake.....................................................................................................7
Figure 3 , In a large bowl, mix together flour, sugar and salt.............................................................................8
Figure 4 . pour the mixture into the floured bowl.................................................................................................8
Figure 5 . Pour the cake mixture into the prepared cake mold. ................................................................... 9
Figure 6 . Place the cake pan in the oven ............................................................................................................. 9
Figure 7 . Check the doneness of the cake.......................................................................................................... 10
Figure 8 . pour the cake out of the mold............................................................................................................. 10
Figure 9 . flow chart............................................................................................................................................. 12
Figure 10 . Steps in program development and explain......................................................................................13
Figure 11 . Visual Studio.......................................................................................................................................20
Figure 12 . Platforms: Visual Studio.....................................................................................................................20
Figure 13 . Overview for c# developers - Visual Studio....................................................................................... 21
Figure 14 . Entire software development cycle in one place...............................................................................21
Figure 15 . Flowchart of the problem of finding prime numbers........................................................................24
Figure 16 . Function .............................................................................................................................................25
Figure 17 . Main method......................................................................................................................................26
Figure 18 . debug..................................................................................................................................................28
Figure 19 . Test cast 1...........................................................................................................................................29
Figure 20 . test cast 2........................................................................................................................................... 30
Figure 21 . test cast again.................................................................................................................................... 31
4
I. Introduction.
Programming is the process of writing source code to create computer programs and software
applications. Programmers use programming languages to create pieces of code that computers can
understand and execute.
Programming plays an important role in building applications and software ranging from mobile apps,
games, websites, and management systems to artificial intelligence and machine learning. By using
programming languages, programmers can create complex software products and solve information
technology problems. Here are some basic concepts related to programming:
1. Programming languages: These are the rules and syntax used to write source code. Every
programming language has its own rules and syntax, e.g. Python, Java, C++, JavaScript.
2. Syntax: The correct syntax and structure for writing source code in a particular programming
language.
3. Compiling and Interpreting: The process of converting source code into machine code is possible.
Compilation converts the entire source code into machine code before execution, while translation
information converts source code line by line into machine code and executes immediately.
4. Variables and data types: Variables are areas of memory allocated to store data. The data type
defines the type of data the variable can contain, for example, integers, real numbers, and string
literals.
5. Structural control structure: A structural structure used to control the execution flow of a program,
including control statements (if-else), loops (for, while), and jump instructions (interrupts, continue).
6. Functions and Classes: A function is a piece of code that can be called back and executed as needed.
A class is a data structure that programmers can create to encapsulate source code and bind data.
7. Libraries and Frameworks: A library is a collection of pre-written code to help programmers solve
specific problems. Framework is an application development architecture that provides a set of tools
and libraries to ease programming work and increase performance.
8. Debugging and Testing: The process of finding and fixing errors in a program is called Debugging.
Testing is the process of checking the correctness and functionality of the program through running
tests.
5
9. Version management: Version management helps set up developers to track and test versions and
changes in source code. Version management systems like Git help stores, track, and merge changes in
software development projects.
10. Object-Oriented Programming (OOP): A programming method that focuses on building objects
that have their properties and interact with each other. OOP uses concepts such as classes, objects,
inheritance, polymorphism, and encapsulation to structure and organize source code.
Programming is not simply about writing code but also involves building algorithms, analyzing
requirements, designing architectures, and testing. In addition, communication skills, logic, creativity,
and problep-solving are also important factors in the field of programming.
Programming is a diverse and ever-evolving field, with many new programming languages, tools, and
techniques being introduced. Learning and mastering basic programming knowledge, analytical and
problem-solving skills will help you succeed in this field.
6
II. Content.
1.What is algorithm.
An algorithm is a step-by-step process or set of rules designed to solve a particular problem or perform a
specific task. It is a set of precise and unambiguous instructions that can be executed by a computer,
human or any other computing device.
In computer science, algorithms play a fundamental role in solving problems and are essential for
programming and software development. They provide a systematic approach to breaking down
complex tasks into smaller, more manageable steps. Algorithms can be expressed in many different
forms, including natural language, pseudocode, flowchart, or programming language.
An algorithm usually consists of a sequence of instructions that determine the order in which certain
operations are performed. These instructions can involve computation, math, logical decisions, data
manipulation, and control structures such as loops and conditions. An algorithm aims to produce a
desired output or solve a particular problem efficiently and accurately.
Figure 1. Algorithms.
7
Efficiency is an important consideration when designing algorithms. Algorithm efficiency refers to its
ability to solve problems with optimal use of resources such as time and memory. Different algorithms
can have different levels of effectiveness for the same problem, and analyzing and comparing their
performance is an important part of algorithm design and analysis.
Algorithms are used in a variety of fields, including computer science, math, engineering, data analysis,
artificial intelligence, and many more. They form the basis of many computational processes, enabling
the development of the software, systems, and technologies that power our modern world.
1.1. For example.
Example algorithm for making a pastry:
Step 1: Prepare necessary materials and tools:
2 cups flour
1 cup sugar
1/2 cup melted butter
1/2 cup milk
2 eggs
1 tablespoon vanilla
1/4 teaspoon salt
1 teaspoon baking powder
Figure 2. Prepare the ingredients for the cake
8
Step 2: First, preheat the oven to 180 degrees Celsius and prepare the cake mold.
Step 3: In a large bowl, mix together flour, sugar and salt.
Figure 3, In a large bowl, mix together flour, sugar and salt.
Step 4: In another bowl, beat eggs, then add melted butter, milk and vanilla. Once well mixed,
pour the mixture into the floured bowl.
Figure 4. pour the mixture into the floured bowl.
9
Step 5: Once you have a homogeneous mixture, add the baking powder and stir well.
Step 6: Pour the cake mixture into the prepared cake mold.
Figure 5. Pour the cake mixture into the prepared cake mold.
Step 7: Place the cake pan in the oven and bake for 30 to 35 minutes.
Figure 6. Place the cake pan in the oven
10
Step 8: Check the doneness of the cake by poking a bamboo stick into the cake. If the bamboo stick
comes out clean without any flour, it means the cake is cooked.
Figure 7. Check the doneness of the cake
Step 9: When the cake is done, pour it out of the mold and let it cool completely before enjoying.
Figure 8. pour the cake out of the mold
11
The algorithm above is a step-by-step guide to making a pastry. By following these steps, you will be
able to create a delicious and sweet cake.
1.2. Pose the problem of solving quadratic equations and draw flow diagrams.
To solve a quadratic equation, we need to find the values of the variable that, when substituted into
the equation, makes the equation a true statement. The quadratic equation has the following general
form:
ax^2 + bx + c = 0
Where, a, b, and c are the coefficients of the equation, and x is the variable we need to find.
There are two main methods for solving quadratic equations: the formula method and the complete
method. Let's look at how to solve a quadratic equation using both methods.
1. Formula method:
This method uses the root formula of quadratic equations:
x = (-b ± (b^2 - 4ac)) / (2a)
Where ± represents two x values to be found: one with a plus sign and one with a minus sign.
2. Complete method:
This method uses the complete trinomial formula to solve quadratic equations:
x = (-b ± (b^2 - 4ac)) / (2a)
However, this method includes adjustment steps to simplify the calculation and avoid problems with
arithmetic precision.
When solving quadratic equations, we need to consider the following cases:
1. If Δ = b^2 - 4ac > 0, the equation has two distinct and real solutions.
2. If Δ = 0, the equation has two real and equal roots.
3. If Δ < 0, the equation has no real solution. In this case, the solutions of the equation will be
complex numbers.
Once you've figured out the value of x, you can test it by substituting x into the original equation and
seeing if it makes the equation a true statement.
12
Draw a flow diagram for the problem of solving quadratic equations:
Figure 9. flow chart
13
2. Steps in program development and explain.
The software development process typically involves many steps and depends on the particular
development method and process by which an application organization is organized. Here is a
common software development method known as the "waterfall software development process" and
includes the basic steps:
1. Problem Definition
2. Problem Analysis
3. Algorithm Development
4. Coding & Documentation
5. Testing & Debugging
6. Maintenance
Figure 10. Steps in program development and explain.
14
2.1. Problem Definition.
The Problem Definition step is the first stage in the software development process. In this step, the
goal is to clearly define and describe the problem the software will solve. This process typically
includes the following activities:
1. Defining Needs: Contact customers or end users to understand their requirements and
needs. Meetings, discussions, and surveys can be used to gather detailed information about the
problem to be solved.
2. Requirements Analysis: Analyze the requirements and functionality needed to solve the
problem. This includes defining required features, user interface, interoperability with other
systems, and other technical constraints.
3. Define the scope: Define the scope of the software project, defining what will be included in
the software and what will not.
4. Set goals and priorities: Identify the main goals and priorities of the project. This helps to
focus on the most important goals and divide the work efficiently.
5. Identify risks: Investigate and identify risks that may affect project success. This helps with
preparedness and the development of strategies to reduce risk.
6. Planning: Define a plan to organize and execute the software development project,
including the schedule, resources, and specific steps to proceed.
The problem definition process is an important step in ensuring that software is developed that meets
the needs and goals of the customer. It helps to shape the direction of development and lays the
foundation for the next steps in the process
2.2. Problem Analysis.
In this step, the goal is to study and analyze in detail the problem defined in the previous step to better
understand its elements and requirements. This process typically includes the following activities:
1. Detailed requirements analysis: Continue the requirements analysis identified in the
problem definition step. This analysis helps to identify possible functions, technical
requirements, mandates, and legal regulations related to the problem.
2. Identify current processes: Research and understand the current process the part is
expected to affect. This includes defining workflows, initiating and outputting data, and current
issues in the process.
3. System Analysis: Identify the systems or applications involved in the problem. This includes
identifying system components, their communication, and how they interact with the problem.
15
4. Identify other factors: Analyze other factors that may influence the problem, such as
technical factors, organizational cultural factors, economic factors, or social factors.
5. Information Collection: Collect information from various sources such as meetings with
clients, related documents, research papers, and data analysis.
6. Capability Assessment: Assess the capabilities of existing technology and resources to solve
the problem. This includes considering technical capabilities, performance, computational
feasibility, and financial requirements.
The problem analysis step is an important process to better understand the factors and requirements
of the previously defined problem. Through detailed analysis, one can identify the information needed
to make decisions and plan the next steps of software development. The main benefits of the problem
analysis step include:
1. Understand the problem: The analysis step helps to better understand the problem to be
solved, including the factors involved, requirements, and constraints.
2. Requirement Determination: Analysis helps to define detailed requirements and
functionality required in the software. This ensures that the software developed will meet the
needs and expectations of the customer.
3. Problem and Risk Detection: The analysis step helps to detect problems and risks that may
arise during software development. This helps to be prepared and put in place risk mitigation
measures.
4. Identify solutions: Through analytical work, it is possible to identify possible solutions to a
problem. This helps to shape the direction of development and to choose the right technology,
tools, and methods.
5. Development planning: The results from the analysis step provide the information needed
to plan the next steps in the software development process, including design, programming,
testing, and deployment.
Through the problem analysis step, we have a basis to clearly define and shape the goals,
requirements, and solutions for the software development project. This plays an important role in the
success of the project.
2.3. Algorithm Development.
In this step, the goal is to design and develop the algorithms and problem-solving logic defined in the
previous steps. This process typically includes the following activities:
1. Determine algorithm requirements: Based on the requirements and requirements of the
problem, determine the functions and tasks that the algorithm needs to perform to solve the
problem.
16
2. Algorithm design: Algorithm design is the process of creating a detailed description of how
an algorithm works, including specific steps and procedures to solve a problem. This can be
done using algorithm design techniques such as decay, scheduling, and matching.
3. Selection of data structure: Determine the appropriate data structure to store and process
data in the algorithm. Data structures can include linked lists, queues, trees, graphs, and more,
depending on the requirements of the algorithm.
4. Algorithm improvement and optimization: Test and optimize the algorithm for best
performance and efficiency. This may include using optimization techniques, creating an
improved version of an algorithm, or performing complexity analyses.
5. Algorithm coding: Converts the designed algorithm into actual source code using a specific
programming language. This process includes writing code, organizing the structure, handling
errors, and creating related documentation.
6. Testing and debugging: Perform testing and debugging on the coded algorithm to ensure
that it works properly and meets the requirements of the problem.
7. Optimization and enhancement: Performance evaluation and algorithm optimization to
improve performance and enhance problep-solving. This may include the use of optimization
techniques, tuning parameters, and taking improvement steps.
8. Evaluation and testing: Evaluate the results of the algorithm through testing and evaluating
correctness, performance, and scalability. Measurements and tests are often used to ensure
that the algorithm works as expected.
9. Documenting: Generate complete related documentation of the algorithm, including
descriptions, diagrams, source code, and instructions for use. This document gives users and
developers a clear understanding of how the algorithm works and how to use it.
10. Delivery and Deployment: Prepare the algorithm for deployment in a real-world
environment. This may include integrating algorithms into software, ensuring compatibility,
and training end users.
The algorithm development step is an important process in the software development process for
designing, building, and testing -solving. Having an accurate, efficient, and optimal algorithm is
important to ensure that the software works as expected and meets the user's requirements.
2.4. Coding & Documentation.
In this step, the goal is to write the source code and create related documentation for the software to
be developed. This process typically includes the following activities:
1. Write source code: based on a previously defined algorithm and design, write source code
to exploit the functionality and logic of the software. The source code is written in a specific
programming language and must adhere to coding rules and standards.
17
2. Test and debug: Perform tests and debug on the source code to ensure that the software
works properly and without errors. This process includes checking the correctness of the code,
handling errors, and correcting detected errors.
3. Source code management: Manage and organize source code in a version management
system like Git to track change history, manage versions, and work collaboratively within the
development team.
4. Create documentation: Create complete softwars-related documentation, including user
manuals, technical documentation, and implementation documentation. This document helps
end users and developers gain a clear understanding of how to use the software and provides
detailed guidance on the structure and operation of the software.
5. Generate source code documentation: Generate source code-related documentation,
including code comments, manuals, and detailed explanations of the code's structure and logic.
This document helps developers understand the source code and guides future developers.
Through the coding and documentation step, source code is extracted and related documentation is
generated to support the exploitation and use of the software. Writing quality and correct source code,
along with the generation of documentation and source code documentation, plays an important role
in ensuring the correct calculation and ease of use of the software. Coding and documentation should
follow common rules and standards for coding, source code management, and documentation.
Some of the benefits of the coding and documentation step include:
1. Correctness Guarantee: Writing correct source code and checking for errors helps to ensure
that the software works as expected and without logical errors.
2. Maintenance Process: The creation of detailed source code documentation and code
comments helps developers understand the source code and make it easier to maintain, repair,
and upgrade the software in the future.
3. How to use: User manuals and documentation help users understand how to use the
software and provide detailed instructions to solve problems that arise.
4. Development Support Team: Source code documentation and streamlined source code
management help developers work together, source code versioning and tracking, and Aid in
software analysis and exploitation.
5. Increased reliability: Accurate and complete related documentation generation increases
the reliability and reliability of the software in the eyes of users and stakeholders.
Through the coding and documentation step, you create the correct source code and related
documentation to support the exploitation, maintenance, and use of the software. This plays an
important role in ensuring correctness, ease of use, and maintenance of the software.
18
2.5. Testing & Debugging.
In this step, the goal is to ensure that the software works properly, without errors, and responds to
user requests. This process typically includes the following activities:
1. Test Planning: Define test plans and test strategies based on the requirements, design, and
requirements of the software. This includes defining test cases, required resources, and test
schedules.
2. Create tests: Build tests to check the correctness and effectiveness of the software. Tests
can include functional testing, unit testing, white box testing, black box testing, and functional
testing.
3. Test execution: Execute defined tests and record test results. This process may require
running the software, providing input, and comparing actual results with expected results.
4. Debugging and Correcting: If an error is detected during testing, the error resolution process
is used to determine the cause and correct the error. This process includes identifying the fault,
recreating the circumstances that led to the failure, and applying problem-solving measures
5. Test again: After fixing the error, perform the tests again to ensure that the error has been
resolved and the software is working correctly.
6. Performance testing: Perform performance testing to evaluate and maximize the
performance of the software. This includes evaluating the software's speed, response time, and
payload in different scenarios.
7. Evaluation and reporting: Evaluate test results and make reports on Check operation and fix
errors. This report provides information on the test results, the defects found, and the
measures taken to resolve them.
8. Collaborative Evaluation Testing: Perform validation testing to ensure that the software
works interoperably and interacts well with various components in the system or related
environment.
9. Test system testing: Comprehensive system testing to be sure that the software works as
expected in the real environment and answers the functional and non-functional required
applications.
Through Testing and Debugging, we are sure that the software has been thoroughly tested and is free
of significant defects. Detected errors will be eliminated and corrected, ensuring that the software
works correctly and responds to user requests.
19
2.6. Maintenance.
The Maintenance step is an important part of the software development process and occurs after the
software is exploited and put into use. This file focuses on maintaining, maintaining, and enhancing the
software throughout its lifecycle. Maintenance is divided into the following activities:
1. Maintenance Request Recording: Record, categorize and prioritize maintenance requests
sent from users or the technical support team. This includes identifying urgent maintenance
requirements that need to be handled and scheduling them.
2. Defect Identification and Analysis: Investigate, analyze, and determine the cause of errors
and problems arising in the software. This process helps to determine the scope and impact of
the error, thereby identifying measures to solve the problem.
3. Bug fixes and upgrades: Implement workarounds and fixes to eliminate bugs and improve
software stability and efficiency. In addition, you can also implement software enhancements
to add new features or improve performance.
4. Testing and validation: Performs testing to ensure that errors have been corrected correctly
and have not hurt other parts of the software. Confirm that the errors are resolved and the
software works as expected.
5. Manage versions and updates or: Manage software versions and update new versions when
there are changes or improvements. This helps track change history, manage versions, and
ensure that users are using the latest and most stable version of the software.
6. User Support: Provide support and guidance to users on how to use the software, resolve
arising development issues, and respond to support requests from users. This includes
providing documentation instructions, and support by phone, email, or an online support
system.
7. Performance measurement: Monitor and measure software performance after deployment
and during maintenance. This helps to identify performance issues and provide measures to
improve performance.
8. Test Period: Perform periodic testing to identify new errors and problems that may arise
during the use of the software. This helps detect problems early and take action to resolve
them before they cause serious software damage.
Through the Maintenance step, we maintain and improve the software throughout its life cycle. Bug
fixes, upgrades, and user support help ensure stability, efficiency, and user satisfaction. In addition,
change management and version control help ensure the consistency and progress of the software
over time.
20
2.7. Introduction to Visual Studio
Visual Studio is an integrated development environment (IDE) developed by Microsoft. It offers a rich
range of tools and features for developing apps for different platforms, including Windows, macOS,
Android, iOS, and more. Here are some details about Visual Studio:
Figure 11. Visual Studio
Platforms: Visual Studio Supports application development on multiple platforms, including C++, C#,
Visual Basic, F#, JavaScript, TypeScript, Python, and many other programming languages.
Figure 12. Platforms: Visual Studio
21
Tools and compilers: Visual Studio comes with a range of powerful tools and compilers to aid in application
development. Includes tools including code editor, error predictor, debugger, compiler, and user interface
generator.
Figure 13. Overview for c# developers - Visual Studio
IntelliSense: Visual Studio uses the IntelliSense feature for code autocompletion, syntax hints, and support
information for programmers. This helps increase performance and accuracy during coding.
Support for error checking and debugging: Visual Studio provides powerful tools to test and fix application
errors. Users can run and test the code step by step, view variables and values during execution, find errors, and
find and fix them.
Figure 14. Entire software development cycle in one place
22
Version management tool integration: Visual Studio integrates with popular version management systems like
Git and Subversion, helping developers easily manage source code and work together on complex projects.
User Interface Design Tools: Visual Studio comes with interactive user interface design tools, allowing users to
create direct interfaces for their applications. Can create Windows Forms, WPF, ASP.NET applications, and
mobile applications.
Community and support: Visual Studio has a large and rich community that provides documentation, tutorials,
tips, and techniques that help users get the most out of the platform's features. Users can search for
information on Microsoft's official website, join forums, join user communities, and even exchange information
via social networking platforms.
Third-party extensions and sharing: Visual Studio Supports third-party extensions and sharing through add-ons
and plugins. Users can download and install add-ons from the Visual Studio extension store to enhance features
and customize them to their needs.
Visual Studio Code: In addition to the full version of Visual Studio, Microsoft also offers Visual Studio Code (VS
Code), a lighter and cross-platform version of the IDE. VS Code is an open-source editor that offers many of the
same features as Visual Studio, but file-focused integration with web development tools and popular
programming language variables.
Versions and licenses: Visual Studio comes in different editions, including Community (free), Professional, and
Enterprise editions. Each version has different features and limitations. Licenses to use Visual Studio are
regulated by Microsoft and may require fees or special licenses depending on the intended use and project type.
Visual Studio has become one of the most popular development tools in the software industry, with the support
and contributions of an expanding community of developers worldwide. It provides a powerful environment for
cross-platform application development and is customizable to meet the specific requirements of each project.
23
3. Solve real problems with algorithms.
3.1 Problem of finding prime numbers in a given range
First, let's pose the problem: The problem of finding prime numbers is a classic problem in
mathematics and programming. The goal of the problem is to find prime numbers in a given range.
A prime number is a number that has only two positive divisors, 1 and itself. Those are numbers that
cannot be divisible by any other positive integer without remainder.
To solve the problem of finding prime numbers, we can use some methods such as:
1. Check each number in the given range:
Iterates each number from 2 to the given range.
Checks if the number is divisible by any number from 2 to the square root of that
Number. If yes, then the number is not prime.
If no divisible number is found, the number is prime and is printed.
2. Sieve of Eratosthenes:
Create a list of numbers from 2 to the given range.
Starting with the number 2, remove all multiples of 2 (except 2).
Next, select the next number that is not discarded and discard all its multiples.
Repeat the process until you have gone through all the numbers in the list.
The remaining numbers in the list are primes and are printed.
24
After posing the problem, we draw a flow diagram for the problem.
Figure 15. Flowchart of the problem of finding prime numbers.
25
4. Workaround (M1).
Explain in detail how to solve problems in c# language.
‘
Figure 16. Function
The above code is a source code in C# language to check if a number is prime or not. Here is a detailed
explanation of each part of the code:
1. Declared namespace testing: This is a way to group functionally related components
together. In this case, we use namespace testing to define a namespace in the source code.
2. Declare the Program class: This is the class containing the Main method and the IsPrime
method.
26
3. IsPrime method: This is the method used to check if a number is prime or not. This method
takes an integer number as an argument and returns a bool value. In this method, we have the
following steps
Check if number is less than 2. If less than 2, i.e. the number is not prime, the method returns false.
Use a for loop to iterate from 2 to the square root of the number.
In the loop, check if number is divisible by any number from 2 to square root. If yes, i.e. the
number is not prime, the method returns false.
If no divisible number is found, i.e. the number is prime, the method returns true.
Figure 17. Main method
Main method: This is the main method of the program. In this method, we have the following steps:
1. Console.WriteLine("Find prime numbers within a given range");: This line displays a
message on the console to inform the user about the purpose of the program.
27
2. Console.Write("Enter the upper limit of the range: ");: This line prompts the user to enter
the upper limit of the range.
3. int limit = int.Parse(Console.ReadLine());: This line reads the user's input from the console,
which represents the upper limit of the range, and assigns it to the limit variable. int.Parse() is
used to convert the user's input from a string to an integer.
4. Console.WriteLine("Prime numbers within the range from 2 to {0} are:", limit);: This line
displays a message on the console to inform the user about the range for which prime numbers
will be found. The {0} is a placeholder that will be replaced with the value of limit.
5. for (int i = 2; i <= limit; i++): This for loop iterates over each number from 2 to the limit
entered by the user.
6. if (IsPrime(i)): This line checks whether the current number i is prime by calling the IsPrime
method. If the IsPrime method returns true, it means the number is prime.
7. Console.WriteLine(i);: If the number is prime, this line prints the current number i on the
console, as it is within the prime number range.
8. After the loop finishes, Console.ReadLine(); is used to keep the console window open until
the user presses Enter, allowing them to see the output before the program exits.
Overall, the Main method prompts the user for the upper limit of the range, finds and prints all prime
numbers within that range using the IsPrime method, and then waits for the user to press Enter to exit
the program.
5. Debug.
To debug the program and identify any potential issues or errors, you can follow these steps:
1. Set breakpoints: Set breakpoints in the code by clicking on the left margin of the line of code
you want to stop. The breakpoint will appear as a red dot. A breakpoint allows you to pause the
program at that point to check the value of the variable and the execution.
2. Select Debug mode: Before running the program, select Debug mode instead of Run mode.
You can select Debug mode by pressing F5 or selecting Debug > Start Debugging from the menu.
28
Figure 18. debug
3. Debugging and Fixing: When you encounter an error or problem in your program, use the
debug information to determine the cause and correct the error. You can tweak the code,
change the value of a variable, or use other debugging tools in Visual Studio to solve the
problem.
Once completed and no more errors, the program will run normally as expected
29
6. Test case
Figure 19. Test cast 1
Test cast 1. input is 100 then output is as expected
30
Figure 20. test cast 2
Test cast 2. If the input is 1, the program will not give any result
use a do-while loop to request re-entry if the input doesn't fit the program
31
first declare variable 'number' then in 'do-while' loop assign variable 'number' = variable 'limit'. next
set condition for 'while' 'while (number < 2);'
The block inside the do-while loop will be executed first. Then the do-while loop will check the
conditional expression, if the conditional expression is true, the program will continue to execute the
block in the do-while, otherwise, if the conditional expression is false, then stop the loop.
The do-while loop is different from the while loop in that the while loop will check the condition first,
while the do-while loop will execute the block first, so the block in the do-while will be executed at
least once.
so when the variable 'number' < 1 the program goes back to execute the statement in the 'do-while'
loop
Figure 21. test cast again
32
7. step by step from coding to running each program.
Here are the steps from writing the code to running the program:
Step 1: Define requirements and design: The first step is to define the main requirements and
general design of the program. This includes defining functionality, data structures, user interfaces,
and other key components.
Step 2: Code: Once the requirements and design have been defined, you can start writing the
source code. Writing code involves using a programming language and supporting tools to create
source code files (.cs in C#) containing functions, classes, and data structures.
Step 3: Syntax check: Before running the program, be sure to check the syntax of the source
code to make sure it follows the rules and context of the programming language. You can use a
compiler or an integrated development environment (IDE) syntas-checking tool to do this.
Step 4: Compilation: The next step is to compile the source code into executable machine code.
The compiler will convert the source code into an executable file (.exe or .dll file in C#) or intermediate
code (in the case of compiled languages like C#).
Step 5: Run the program: Once the code has been compiled, you can run the program by
starting the corresponding executable. The program will start executing and performing the actions
defined in the source code.
Step 6: Testing: During the running of the program, test the functions and determine if the
program works as expected. You can use predefined test scenarios and test cases to confirm the
correctness and performance of the program.
Step 7: Debugging and Fixing: If you encounter errors or problems during testing, use
debugging tools to determine the cause and location of the error. Use tools such as the compiler, the
IDE's built-in debugger, or a separate debugging tool to monitor variable values, view error messages,
and investigate program flow. Once you have located the error, you can repair the source code to fix
the problem.
33
Step 8: Retest: After fixing the error, run the test cases again and test the program again to make sure
that the error has been fixed and the program works as expected.
Step 9: Deployment: If the program has matured and passed the testing process, you can deploy it for
use in a real environment. Deployment may include packaging the program, installing it on a computer
or server, and verifying that the program works properly in the deployment environment.
Step 10: Maintenance: Once the program has been deployed, the next task is to maintain and repair
the program as needed. This includes handling errors that arise from the user or the environment,
improving functionality, and ensuring the stability and performance of the program in the long run.
The process from writing code to running the program is a relatively sequential series of steps, but
there can be overlap and repetition between the different steps. It is important to maintain a careful
process to ensure the quality and performance of your program.
8. Check the algorithm implementation in C# language
To check the algorithm implementation in C# language, you can use the following steps:
1. Define test cases: Define the test cases that you will use to test the algorithm. Make sure to
choose test cases that represent the special and boundary cases of the algorithm.
2. Write test code: Using C# language, write source code to execute test cases and check the
results of the algorithm. You can use automated test methods like NUnit, MSTest, or xUnit to
write and run test suites.
3. Test Run: Run test suites to execute the defined test cases. Check the results returned by
the algorithm and verify that they are as expected. Using automated testing methods will make
it easier for you to identify errors and gain a better understanding of how your algorithm is
implemented.
4. Debug and fix errors: If the tester detects an error or incorrect results, use debugging tools
to determine the cause and location of the error. Use tools such as the IDE's built-in debugger
(Integrated Development Environment) to monitor variable values and investigate program
flow. Then fix the error and run the test suites again to make sure that the algorithm is working
properly.
5. Performance testing: If necessary, you can also test the algorithm's performance by
measuring execution time and using performance measurement tools like StopWatch in C#.
34
Testing the algorithm implementation in C# language is very important to ensure the correctness and
performance of the program. By performing tests and using supporting tools, you can ensure that your
algorithm works properly and gives accurate results.
9. Evaluate the relationship between writing algorithms and using variables in the program.
The relationship between writing algorithms and using variables in the program is very close and
similar. Here are some reviews of this connection:
1. Come up with an algorithm: Writing an algorithm requires you to define the steps that need
to be taken to solve the problem. In the process, you need to define the variables to use to
store the data, intermediates, and results. Identifying the right variables is necessary for the
algorithm to function properly.
2. Using variables in algorithms: When writing algorithms, you will use variables to store and
process data. Variables will hold the values of the elements, perform calculations, and store the
state of the algorithm. The correct and reasonable use of variables will ensure the correctness
and efficiency of the algorithm.
3. Manage and track variables: During the implementation of an algorithm, you need to
manage and monitor variables to ensure that they have valid and expected values. You need to
initialize variables, and assign and update their values as required by the algorithm. It is
important to check the validity of the variable value before using it to avoid unexpected errors.
4. Optimizing variable usage: Optimizing variable usage is important to reduce memory usage
and increase program performance. You need to consider getting rid of unnecessary variables,
using variables with appropriate data types, and optimizing the way variables are accessed and
manipulated. This reduces the load on the memory and increases the execution speed of the
algorithm.
5.
In short, writing algorithms and using variables in the program are closely related. Identifying and
using the right variables is important to solving problems correctly and effectively. At the same time,
the management, monitoring, and optimization of variable usage also play an important role in
ensuring the correctness, performance, and optimization of the algorithm.
In the process of writing an algorithm, you need to define the variables needed to store the
information, the intermediary, and the result of the algorithm. Using variables correctly and rationally
helps to ensure the correctness of the algorithm and achieve the desired results.
35
In addition, it is important to manage and track variables during algorithm implementation. You need
to initialize, assign and update the values of the variables as required by the algorithm. Also, checking
the validity of the variable value before use helps to avoid unexpected errors.
Optimizing variable usage also plays an important role. You need to consider getting rid of unnecessary
variables, using the right data types, and optimizing the way variables are accessed and manipulated.
This reduces the load on the memory and increases the execution speed of the algorithm.
In summary, writing algorithms and using variables in the program are closely related and similar. The
identification, use, management, and optimization of variables play an important role in ensuring the
correctness, performance, and optimization of the algorithm.
36
III. Conclusion.
In this essay, I will start by introducing the concept of algorithms. I will explain what algorithms are and
how important they are in solving problems effectively.
To illustrate this concept, I will provide an example of an algorithm by describing the steps involved in
completing a task, such as baking a cake or preparing a meal. This will help demonstrate how
algorithms are used in everyday life to solve specific problems.
I then present a problem to be solved, along with a flowchart. Problems can range from solving
quadratic equations to developing computer software or applying simple multiple-choice tests.
Program development steps
Next, I will outline the steps involved in developing a program. I will explain the following stages:
Defining: This involves understanding the problem and its requirements, as well as defining the
program's inputs, outputs, and constraints.
Design: In this phase, I create a plan or blueprint for the structure of the program, including algorithms,
data structures, and the user interface.
Code: Here, I write the actual code in a programming language like C#, translating algorithms and
designs into executable instructions.
Documentation: Proper documentation is essential to maintaining and understanding the program. I
will stress the importance of documenting the code, including comments and explanations.
Compile and run: After the code is written, I compile it into machine-readable instructions and execute
the program to observe its behavior.
Testing and debugging: I will discuss the importance of testing a program to ensure its correctness and
reliability. I will also explain the process of identifying and correcting bugs or errors in the code.
Maintenance: Programs require ongoing maintenance to resolve problems, add new features, and
adapt to changes. I will emphasize the need for regular updates and improvements to ensure the
program remains effective.
37
Solve problems with algorithms.
In this section, I will explore how algorithms can be applied to solve problems efficiently. I will provide
detailed explanations and source code examples to demonstrate how to solve specific problems with
algorithms.
I will also discuss program interface design, including graphical user interfaces (GUIs), and explain how
to create user-friendly and visually appealing interfaces for a better user experience.
Furthermore, I'll dive into the concept of functions and their role in modularizing code, improving code
organization, and promoting code reuse.
I will emphasize the importance of debugging techniques in identifying and resolving errors or
problems in a program. I will discuss different debugging tools and strategies to debug code efficiently.
Finally, I will discuss the importance of test cases in verifying the correctness and robustness of a
program. I will explore different types of test cases and their role in making sure the program works as
expected.
Define the steps from coding to execution
I will provide a comprehensive overview of the steps involved in coding and executing a program. This
will include activities such as coding, compiling, linking, and running the program.
Evaluation of algorithm implementation and variable usage in C#
I will examine the implementation of algorithms in the C# programming language. We will evaluate the
relationship between algorithm design and the use of variables in the program. This review will
emphasize the importance of using the right variables to ensure the accuracy and efficiency of the
algorithm.
In summary, this essay covers various aspects related to algorithms, program development, problep-
solving techniques, and the use of variables. By understanding these concepts and following the steps
outlined, developers can create well-designed, efficient, and reliable programs that effectively solve
real-world problems.
38
IV. Reference list.
[1]. Stages of program development process (Program development steps) || CseWorld Online.
[online] Available at: https://www.cseworldonline.com/articles/stages-of-program-
development-process.php
[2]. Prabhu, R. (2019). Introduction to Algorithms. [online] GeeksforGeeks. Available at:
https://www.geeksforgeeks.org/introduction-to-algorithms/
[3]. How Algorithms Are Used for Problem Solving in Psychology. [online] Verywell Mind.
Available at: https://www.verywellmind.com/what-is-an-algorithm-2794807
[4]. Carneiro, B. (2022). Java code without any workaround. [online] GitHub. Available at:
https://github.com/Tautorn/java-code-without-any-workaround/blob/master/README.md

More Related Content

Similar to ASM1-PROGRAMMING-1ST-NguyenTheCuong-BH00387-.pdf (1).pdf

BSc Statistical Project
BSc Statistical ProjectBSc Statistical Project
BSc Statistical ProjectCollins Okoyo
 
AIRLINE RESERVATION SYSTEM.pdf
AIRLINE RESERVATION SYSTEM.pdfAIRLINE RESERVATION SYSTEM.pdf
AIRLINE RESERVATION SYSTEM.pdfCarrie Romero
 
Thesis-aligned-sc13m055
Thesis-aligned-sc13m055Thesis-aligned-sc13m055
Thesis-aligned-sc13m055Mohan Kashyap
 
Comparative Implementation of AES-based Crypto-Cores
Comparative Implementation of AES-based Crypto-CoresComparative Implementation of AES-based Crypto-Cores
Comparative Implementation of AES-based Crypto-CoresMuhammad Asim Zahid
 
Computational thinking v0.1_13-oct-2020
Computational thinking v0.1_13-oct-2020Computational thinking v0.1_13-oct-2020
Computational thinking v0.1_13-oct-2020Gora Buzz
 
SAP MM Tutorial ds_42_tutorial_en.pdf
SAP MM Tutorial    ds_42_tutorial_en.pdfSAP MM Tutorial    ds_42_tutorial_en.pdf
SAP MM Tutorial ds_42_tutorial_en.pdfsjha120721
 
Project final report
Project final reportProject final report
Project final reportALIN BABU
 
Chuck Moore Book 2012 01 26
Chuck Moore Book 2012 01 26Chuck Moore Book 2012 01 26
Chuck Moore Book 2012 01 26JuergenPintaske
 
Using Open Source Tools For STR7XX Cross Development
Using Open Source Tools For STR7XX Cross DevelopmentUsing Open Source Tools For STR7XX Cross Development
Using Open Source Tools For STR7XX Cross DevelopmentGiacomo Antonino Fazio
 
D4.3. Content and Concept Filter V1
D4.3. Content and Concept Filter V1D4.3. Content and Concept Filter V1
D4.3. Content and Concept Filter V1LinkedTV
 
iGUARD: An Intelligent Way To Secure - Report
iGUARD: An Intelligent Way To Secure - ReportiGUARD: An Intelligent Way To Secure - Report
iGUARD: An Intelligent Way To Secure - ReportNandu B Rajan
 
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...Nóra Szepes
 
Work Measurement Application - Ghent Internship Report - Adel Belasker
Work Measurement Application - Ghent Internship Report - Adel BelaskerWork Measurement Application - Ghent Internship Report - Adel Belasker
Work Measurement Application - Ghent Internship Report - Adel BelaskerAdel Belasker
 
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...Jason Cheung
 
Smart Speaker as Studying Assistant by Joao Pargana
Smart Speaker as Studying Assistant by Joao ParganaSmart Speaker as Studying Assistant by Joao Pargana
Smart Speaker as Studying Assistant by Joao ParganaHendrik Drachsler
 

Similar to ASM1-PROGRAMMING-1ST-NguyenTheCuong-BH00387-.pdf (1).pdf (20)

TechWriterSamples
TechWriterSamplesTechWriterSamples
TechWriterSamples
 
CS4099Report
CS4099ReportCS4099Report
CS4099Report
 
BSc Statistical Project
BSc Statistical ProjectBSc Statistical Project
BSc Statistical Project
 
diss
dissdiss
diss
 
AIRLINE RESERVATION SYSTEM.pdf
AIRLINE RESERVATION SYSTEM.pdfAIRLINE RESERVATION SYSTEM.pdf
AIRLINE RESERVATION SYSTEM.pdf
 
Thesis-aligned-sc13m055
Thesis-aligned-sc13m055Thesis-aligned-sc13m055
Thesis-aligned-sc13m055
 
Comparative Implementation of AES-based Crypto-Cores
Comparative Implementation of AES-based Crypto-CoresComparative Implementation of AES-based Crypto-Cores
Comparative Implementation of AES-based Crypto-Cores
 
BA_FCaballero
BA_FCaballeroBA_FCaballero
BA_FCaballero
 
C++ progrmming language
C++ progrmming languageC++ progrmming language
C++ progrmming language
 
Computational thinking v0.1_13-oct-2020
Computational thinking v0.1_13-oct-2020Computational thinking v0.1_13-oct-2020
Computational thinking v0.1_13-oct-2020
 
SAP MM Tutorial ds_42_tutorial_en.pdf
SAP MM Tutorial    ds_42_tutorial_en.pdfSAP MM Tutorial    ds_42_tutorial_en.pdf
SAP MM Tutorial ds_42_tutorial_en.pdf
 
Project final report
Project final reportProject final report
Project final report
 
Chuck Moore Book 2012 01 26
Chuck Moore Book 2012 01 26Chuck Moore Book 2012 01 26
Chuck Moore Book 2012 01 26
 
Using Open Source Tools For STR7XX Cross Development
Using Open Source Tools For STR7XX Cross DevelopmentUsing Open Source Tools For STR7XX Cross Development
Using Open Source Tools For STR7XX Cross Development
 
D4.3. Content and Concept Filter V1
D4.3. Content and Concept Filter V1D4.3. Content and Concept Filter V1
D4.3. Content and Concept Filter V1
 
iGUARD: An Intelligent Way To Secure - Report
iGUARD: An Intelligent Way To Secure - ReportiGUARD: An Intelligent Way To Secure - Report
iGUARD: An Intelligent Way To Secure - Report
 
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...
Thesis - Nora Szepes - Design and Implementation of an Educational Support Sy...
 
Work Measurement Application - Ghent Internship Report - Adel Belasker
Work Measurement Application - Ghent Internship Report - Adel BelaskerWork Measurement Application - Ghent Internship Report - Adel Belasker
Work Measurement Application - Ghent Internship Report - Adel Belasker
 
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...
Trinity Impulse - Event Aggregation to Increase Stundents Awareness of Events...
 
Smart Speaker as Studying Assistant by Joao Pargana
Smart Speaker as Studying Assistant by Joao ParganaSmart Speaker as Studying Assistant by Joao Pargana
Smart Speaker as Studying Assistant by Joao Pargana
 

Recently uploaded

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 

Recently uploaded (20)

CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 

ASM1-PROGRAMMING-1ST-NguyenTheCuong-BH00387-.pdf (1).pdf

  • 1. 1 ASSIGNMENT 1 FRONT SHEET 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 NGUYEN THE CUONG Student ID BH00387 Class Assessor name DINH VAN DONG 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 Cuong Grading grid P1 M1 D1
  • 2. 1 ❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature:
  • 3. 2 Table of Content I. Introduction.................................................................................................................................................................4 II. Content...................................................................................................................................................................... 6 1.What is algorithm................................................................................................................................................6 1.1. For example.............................................................................................................................................7 1.2. Pose the problem of solving quadratic equations and draw flow diagrams........................................11 2. Steps in program development and explain....................................................................................................13 2.1. Problem Definition................................................................................................................................14 2.2. Problem Analysis...................................................................................................................................14 2.3. Algorithm Development........................................................................................................................15 2.4. Coding & Documentation......................................................................................................................16 2.5. Testing & Debugging.............................................................................................................................18 2.6. Maintenance......................................................................................................................................... 19 2.7. Introduction to Visual Studio................................................................................................................20 3. Solve real problems with algorithms............................................................................................................... 23 3.1 Problem of finding prime numbers in a given range............................................................................. 23 4. Workaround (M1)............................................................................................................................................ 25 5. Debug............................................................................................................................................................... 27 6. Test case...........................................................................................................................................................29 7. step by step from coding to running each program........................................................................................32 8. Check the algorithm implementation in C# language..................................................................................... 33 9. Evaluate the relationship between writing algorithms and using variables in the program.......................... 34 III. Conclusion...............................................................................................................................................................36 IV. Reference list.......................................................................................................................................................... 38
  • 4. 3 Table of figures Figure 1 . Algorithms..............................................................................................................................................6 Figure 2 . Prepare the ingredients for the cake.....................................................................................................7 Figure 3 , In a large bowl, mix together flour, sugar and salt.............................................................................8 Figure 4 . pour the mixture into the floured bowl.................................................................................................8 Figure 5 . Pour the cake mixture into the prepared cake mold. ................................................................... 9 Figure 6 . Place the cake pan in the oven ............................................................................................................. 9 Figure 7 . Check the doneness of the cake.......................................................................................................... 10 Figure 8 . pour the cake out of the mold............................................................................................................. 10 Figure 9 . flow chart............................................................................................................................................. 12 Figure 10 . Steps in program development and explain......................................................................................13 Figure 11 . Visual Studio.......................................................................................................................................20 Figure 12 . Platforms: Visual Studio.....................................................................................................................20 Figure 13 . Overview for c# developers - Visual Studio....................................................................................... 21 Figure 14 . Entire software development cycle in one place...............................................................................21 Figure 15 . Flowchart of the problem of finding prime numbers........................................................................24 Figure 16 . Function .............................................................................................................................................25 Figure 17 . Main method......................................................................................................................................26 Figure 18 . debug..................................................................................................................................................28 Figure 19 . Test cast 1...........................................................................................................................................29 Figure 20 . test cast 2........................................................................................................................................... 30 Figure 21 . test cast again.................................................................................................................................... 31
  • 5. 4 I. Introduction. Programming is the process of writing source code to create computer programs and software applications. Programmers use programming languages to create pieces of code that computers can understand and execute. Programming plays an important role in building applications and software ranging from mobile apps, games, websites, and management systems to artificial intelligence and machine learning. By using programming languages, programmers can create complex software products and solve information technology problems. Here are some basic concepts related to programming: 1. Programming languages: These are the rules and syntax used to write source code. Every programming language has its own rules and syntax, e.g. Python, Java, C++, JavaScript. 2. Syntax: The correct syntax and structure for writing source code in a particular programming language. 3. Compiling and Interpreting: The process of converting source code into machine code is possible. Compilation converts the entire source code into machine code before execution, while translation information converts source code line by line into machine code and executes immediately. 4. Variables and data types: Variables are areas of memory allocated to store data. The data type defines the type of data the variable can contain, for example, integers, real numbers, and string literals. 5. Structural control structure: A structural structure used to control the execution flow of a program, including control statements (if-else), loops (for, while), and jump instructions (interrupts, continue). 6. Functions and Classes: A function is a piece of code that can be called back and executed as needed. A class is a data structure that programmers can create to encapsulate source code and bind data. 7. Libraries and Frameworks: A library is a collection of pre-written code to help programmers solve specific problems. Framework is an application development architecture that provides a set of tools and libraries to ease programming work and increase performance. 8. Debugging and Testing: The process of finding and fixing errors in a program is called Debugging. Testing is the process of checking the correctness and functionality of the program through running tests.
  • 6. 5 9. Version management: Version management helps set up developers to track and test versions and changes in source code. Version management systems like Git help stores, track, and merge changes in software development projects. 10. Object-Oriented Programming (OOP): A programming method that focuses on building objects that have their properties and interact with each other. OOP uses concepts such as classes, objects, inheritance, polymorphism, and encapsulation to structure and organize source code. Programming is not simply about writing code but also involves building algorithms, analyzing requirements, designing architectures, and testing. In addition, communication skills, logic, creativity, and problep-solving are also important factors in the field of programming. Programming is a diverse and ever-evolving field, with many new programming languages, tools, and techniques being introduced. Learning and mastering basic programming knowledge, analytical and problem-solving skills will help you succeed in this field.
  • 7. 6 II. Content. 1.What is algorithm. An algorithm is a step-by-step process or set of rules designed to solve a particular problem or perform a specific task. It is a set of precise and unambiguous instructions that can be executed by a computer, human or any other computing device. In computer science, algorithms play a fundamental role in solving problems and are essential for programming and software development. They provide a systematic approach to breaking down complex tasks into smaller, more manageable steps. Algorithms can be expressed in many different forms, including natural language, pseudocode, flowchart, or programming language. An algorithm usually consists of a sequence of instructions that determine the order in which certain operations are performed. These instructions can involve computation, math, logical decisions, data manipulation, and control structures such as loops and conditions. An algorithm aims to produce a desired output or solve a particular problem efficiently and accurately. Figure 1. Algorithms.
  • 8. 7 Efficiency is an important consideration when designing algorithms. Algorithm efficiency refers to its ability to solve problems with optimal use of resources such as time and memory. Different algorithms can have different levels of effectiveness for the same problem, and analyzing and comparing their performance is an important part of algorithm design and analysis. Algorithms are used in a variety of fields, including computer science, math, engineering, data analysis, artificial intelligence, and many more. They form the basis of many computational processes, enabling the development of the software, systems, and technologies that power our modern world. 1.1. For example. Example algorithm for making a pastry: Step 1: Prepare necessary materials and tools: 2 cups flour 1 cup sugar 1/2 cup melted butter 1/2 cup milk 2 eggs 1 tablespoon vanilla 1/4 teaspoon salt 1 teaspoon baking powder Figure 2. Prepare the ingredients for the cake
  • 9. 8 Step 2: First, preheat the oven to 180 degrees Celsius and prepare the cake mold. Step 3: In a large bowl, mix together flour, sugar and salt. Figure 3, In a large bowl, mix together flour, sugar and salt. Step 4: In another bowl, beat eggs, then add melted butter, milk and vanilla. Once well mixed, pour the mixture into the floured bowl. Figure 4. pour the mixture into the floured bowl.
  • 10. 9 Step 5: Once you have a homogeneous mixture, add the baking powder and stir well. Step 6: Pour the cake mixture into the prepared cake mold. Figure 5. Pour the cake mixture into the prepared cake mold. Step 7: Place the cake pan in the oven and bake for 30 to 35 minutes. Figure 6. Place the cake pan in the oven
  • 11. 10 Step 8: Check the doneness of the cake by poking a bamboo stick into the cake. If the bamboo stick comes out clean without any flour, it means the cake is cooked. Figure 7. Check the doneness of the cake Step 9: When the cake is done, pour it out of the mold and let it cool completely before enjoying. Figure 8. pour the cake out of the mold
  • 12. 11 The algorithm above is a step-by-step guide to making a pastry. By following these steps, you will be able to create a delicious and sweet cake. 1.2. Pose the problem of solving quadratic equations and draw flow diagrams. To solve a quadratic equation, we need to find the values of the variable that, when substituted into the equation, makes the equation a true statement. The quadratic equation has the following general form: ax^2 + bx + c = 0 Where, a, b, and c are the coefficients of the equation, and x is the variable we need to find. There are two main methods for solving quadratic equations: the formula method and the complete method. Let's look at how to solve a quadratic equation using both methods. 1. Formula method: This method uses the root formula of quadratic equations: x = (-b ± (b^2 - 4ac)) / (2a) Where ± represents two x values to be found: one with a plus sign and one with a minus sign. 2. Complete method: This method uses the complete trinomial formula to solve quadratic equations: x = (-b ± (b^2 - 4ac)) / (2a) However, this method includes adjustment steps to simplify the calculation and avoid problems with arithmetic precision. When solving quadratic equations, we need to consider the following cases: 1. If Δ = b^2 - 4ac > 0, the equation has two distinct and real solutions. 2. If Δ = 0, the equation has two real and equal roots. 3. If Δ < 0, the equation has no real solution. In this case, the solutions of the equation will be complex numbers. Once you've figured out the value of x, you can test it by substituting x into the original equation and seeing if it makes the equation a true statement.
  • 13. 12 Draw a flow diagram for the problem of solving quadratic equations: Figure 9. flow chart
  • 14. 13 2. Steps in program development and explain. The software development process typically involves many steps and depends on the particular development method and process by which an application organization is organized. Here is a common software development method known as the "waterfall software development process" and includes the basic steps: 1. Problem Definition 2. Problem Analysis 3. Algorithm Development 4. Coding & Documentation 5. Testing & Debugging 6. Maintenance Figure 10. Steps in program development and explain.
  • 15. 14 2.1. Problem Definition. The Problem Definition step is the first stage in the software development process. In this step, the goal is to clearly define and describe the problem the software will solve. This process typically includes the following activities: 1. Defining Needs: Contact customers or end users to understand their requirements and needs. Meetings, discussions, and surveys can be used to gather detailed information about the problem to be solved. 2. Requirements Analysis: Analyze the requirements and functionality needed to solve the problem. This includes defining required features, user interface, interoperability with other systems, and other technical constraints. 3. Define the scope: Define the scope of the software project, defining what will be included in the software and what will not. 4. Set goals and priorities: Identify the main goals and priorities of the project. This helps to focus on the most important goals and divide the work efficiently. 5. Identify risks: Investigate and identify risks that may affect project success. This helps with preparedness and the development of strategies to reduce risk. 6. Planning: Define a plan to organize and execute the software development project, including the schedule, resources, and specific steps to proceed. The problem definition process is an important step in ensuring that software is developed that meets the needs and goals of the customer. It helps to shape the direction of development and lays the foundation for the next steps in the process 2.2. Problem Analysis. In this step, the goal is to study and analyze in detail the problem defined in the previous step to better understand its elements and requirements. This process typically includes the following activities: 1. Detailed requirements analysis: Continue the requirements analysis identified in the problem definition step. This analysis helps to identify possible functions, technical requirements, mandates, and legal regulations related to the problem. 2. Identify current processes: Research and understand the current process the part is expected to affect. This includes defining workflows, initiating and outputting data, and current issues in the process. 3. System Analysis: Identify the systems or applications involved in the problem. This includes identifying system components, their communication, and how they interact with the problem.
  • 16. 15 4. Identify other factors: Analyze other factors that may influence the problem, such as technical factors, organizational cultural factors, economic factors, or social factors. 5. Information Collection: Collect information from various sources such as meetings with clients, related documents, research papers, and data analysis. 6. Capability Assessment: Assess the capabilities of existing technology and resources to solve the problem. This includes considering technical capabilities, performance, computational feasibility, and financial requirements. The problem analysis step is an important process to better understand the factors and requirements of the previously defined problem. Through detailed analysis, one can identify the information needed to make decisions and plan the next steps of software development. The main benefits of the problem analysis step include: 1. Understand the problem: The analysis step helps to better understand the problem to be solved, including the factors involved, requirements, and constraints. 2. Requirement Determination: Analysis helps to define detailed requirements and functionality required in the software. This ensures that the software developed will meet the needs and expectations of the customer. 3. Problem and Risk Detection: The analysis step helps to detect problems and risks that may arise during software development. This helps to be prepared and put in place risk mitigation measures. 4. Identify solutions: Through analytical work, it is possible to identify possible solutions to a problem. This helps to shape the direction of development and to choose the right technology, tools, and methods. 5. Development planning: The results from the analysis step provide the information needed to plan the next steps in the software development process, including design, programming, testing, and deployment. Through the problem analysis step, we have a basis to clearly define and shape the goals, requirements, and solutions for the software development project. This plays an important role in the success of the project. 2.3. Algorithm Development. In this step, the goal is to design and develop the algorithms and problem-solving logic defined in the previous steps. This process typically includes the following activities: 1. Determine algorithm requirements: Based on the requirements and requirements of the problem, determine the functions and tasks that the algorithm needs to perform to solve the problem.
  • 17. 16 2. Algorithm design: Algorithm design is the process of creating a detailed description of how an algorithm works, including specific steps and procedures to solve a problem. This can be done using algorithm design techniques such as decay, scheduling, and matching. 3. Selection of data structure: Determine the appropriate data structure to store and process data in the algorithm. Data structures can include linked lists, queues, trees, graphs, and more, depending on the requirements of the algorithm. 4. Algorithm improvement and optimization: Test and optimize the algorithm for best performance and efficiency. This may include using optimization techniques, creating an improved version of an algorithm, or performing complexity analyses. 5. Algorithm coding: Converts the designed algorithm into actual source code using a specific programming language. This process includes writing code, organizing the structure, handling errors, and creating related documentation. 6. Testing and debugging: Perform testing and debugging on the coded algorithm to ensure that it works properly and meets the requirements of the problem. 7. Optimization and enhancement: Performance evaluation and algorithm optimization to improve performance and enhance problep-solving. This may include the use of optimization techniques, tuning parameters, and taking improvement steps. 8. Evaluation and testing: Evaluate the results of the algorithm through testing and evaluating correctness, performance, and scalability. Measurements and tests are often used to ensure that the algorithm works as expected. 9. Documenting: Generate complete related documentation of the algorithm, including descriptions, diagrams, source code, and instructions for use. This document gives users and developers a clear understanding of how the algorithm works and how to use it. 10. Delivery and Deployment: Prepare the algorithm for deployment in a real-world environment. This may include integrating algorithms into software, ensuring compatibility, and training end users. The algorithm development step is an important process in the software development process for designing, building, and testing -solving. Having an accurate, efficient, and optimal algorithm is important to ensure that the software works as expected and meets the user's requirements. 2.4. Coding & Documentation. In this step, the goal is to write the source code and create related documentation for the software to be developed. This process typically includes the following activities: 1. Write source code: based on a previously defined algorithm and design, write source code to exploit the functionality and logic of the software. The source code is written in a specific programming language and must adhere to coding rules and standards.
  • 18. 17 2. Test and debug: Perform tests and debug on the source code to ensure that the software works properly and without errors. This process includes checking the correctness of the code, handling errors, and correcting detected errors. 3. Source code management: Manage and organize source code in a version management system like Git to track change history, manage versions, and work collaboratively within the development team. 4. Create documentation: Create complete softwars-related documentation, including user manuals, technical documentation, and implementation documentation. This document helps end users and developers gain a clear understanding of how to use the software and provides detailed guidance on the structure and operation of the software. 5. Generate source code documentation: Generate source code-related documentation, including code comments, manuals, and detailed explanations of the code's structure and logic. This document helps developers understand the source code and guides future developers. Through the coding and documentation step, source code is extracted and related documentation is generated to support the exploitation and use of the software. Writing quality and correct source code, along with the generation of documentation and source code documentation, plays an important role in ensuring the correct calculation and ease of use of the software. Coding and documentation should follow common rules and standards for coding, source code management, and documentation. Some of the benefits of the coding and documentation step include: 1. Correctness Guarantee: Writing correct source code and checking for errors helps to ensure that the software works as expected and without logical errors. 2. Maintenance Process: The creation of detailed source code documentation and code comments helps developers understand the source code and make it easier to maintain, repair, and upgrade the software in the future. 3. How to use: User manuals and documentation help users understand how to use the software and provide detailed instructions to solve problems that arise. 4. Development Support Team: Source code documentation and streamlined source code management help developers work together, source code versioning and tracking, and Aid in software analysis and exploitation. 5. Increased reliability: Accurate and complete related documentation generation increases the reliability and reliability of the software in the eyes of users and stakeholders. Through the coding and documentation step, you create the correct source code and related documentation to support the exploitation, maintenance, and use of the software. This plays an important role in ensuring correctness, ease of use, and maintenance of the software.
  • 19. 18 2.5. Testing & Debugging. In this step, the goal is to ensure that the software works properly, without errors, and responds to user requests. This process typically includes the following activities: 1. Test Planning: Define test plans and test strategies based on the requirements, design, and requirements of the software. This includes defining test cases, required resources, and test schedules. 2. Create tests: Build tests to check the correctness and effectiveness of the software. Tests can include functional testing, unit testing, white box testing, black box testing, and functional testing. 3. Test execution: Execute defined tests and record test results. This process may require running the software, providing input, and comparing actual results with expected results. 4. Debugging and Correcting: If an error is detected during testing, the error resolution process is used to determine the cause and correct the error. This process includes identifying the fault, recreating the circumstances that led to the failure, and applying problem-solving measures 5. Test again: After fixing the error, perform the tests again to ensure that the error has been resolved and the software is working correctly. 6. Performance testing: Perform performance testing to evaluate and maximize the performance of the software. This includes evaluating the software's speed, response time, and payload in different scenarios. 7. Evaluation and reporting: Evaluate test results and make reports on Check operation and fix errors. This report provides information on the test results, the defects found, and the measures taken to resolve them. 8. Collaborative Evaluation Testing: Perform validation testing to ensure that the software works interoperably and interacts well with various components in the system or related environment. 9. Test system testing: Comprehensive system testing to be sure that the software works as expected in the real environment and answers the functional and non-functional required applications. Through Testing and Debugging, we are sure that the software has been thoroughly tested and is free of significant defects. Detected errors will be eliminated and corrected, ensuring that the software works correctly and responds to user requests.
  • 20. 19 2.6. Maintenance. The Maintenance step is an important part of the software development process and occurs after the software is exploited and put into use. This file focuses on maintaining, maintaining, and enhancing the software throughout its lifecycle. Maintenance is divided into the following activities: 1. Maintenance Request Recording: Record, categorize and prioritize maintenance requests sent from users or the technical support team. This includes identifying urgent maintenance requirements that need to be handled and scheduling them. 2. Defect Identification and Analysis: Investigate, analyze, and determine the cause of errors and problems arising in the software. This process helps to determine the scope and impact of the error, thereby identifying measures to solve the problem. 3. Bug fixes and upgrades: Implement workarounds and fixes to eliminate bugs and improve software stability and efficiency. In addition, you can also implement software enhancements to add new features or improve performance. 4. Testing and validation: Performs testing to ensure that errors have been corrected correctly and have not hurt other parts of the software. Confirm that the errors are resolved and the software works as expected. 5. Manage versions and updates or: Manage software versions and update new versions when there are changes or improvements. This helps track change history, manage versions, and ensure that users are using the latest and most stable version of the software. 6. User Support: Provide support and guidance to users on how to use the software, resolve arising development issues, and respond to support requests from users. This includes providing documentation instructions, and support by phone, email, or an online support system. 7. Performance measurement: Monitor and measure software performance after deployment and during maintenance. This helps to identify performance issues and provide measures to improve performance. 8. Test Period: Perform periodic testing to identify new errors and problems that may arise during the use of the software. This helps detect problems early and take action to resolve them before they cause serious software damage. Through the Maintenance step, we maintain and improve the software throughout its life cycle. Bug fixes, upgrades, and user support help ensure stability, efficiency, and user satisfaction. In addition, change management and version control help ensure the consistency and progress of the software over time.
  • 21. 20 2.7. Introduction to Visual Studio Visual Studio is an integrated development environment (IDE) developed by Microsoft. It offers a rich range of tools and features for developing apps for different platforms, including Windows, macOS, Android, iOS, and more. Here are some details about Visual Studio: Figure 11. Visual Studio Platforms: Visual Studio Supports application development on multiple platforms, including C++, C#, Visual Basic, F#, JavaScript, TypeScript, Python, and many other programming languages. Figure 12. Platforms: Visual Studio
  • 22. 21 Tools and compilers: Visual Studio comes with a range of powerful tools and compilers to aid in application development. Includes tools including code editor, error predictor, debugger, compiler, and user interface generator. Figure 13. Overview for c# developers - Visual Studio IntelliSense: Visual Studio uses the IntelliSense feature for code autocompletion, syntax hints, and support information for programmers. This helps increase performance and accuracy during coding. Support for error checking and debugging: Visual Studio provides powerful tools to test and fix application errors. Users can run and test the code step by step, view variables and values during execution, find errors, and find and fix them. Figure 14. Entire software development cycle in one place
  • 23. 22 Version management tool integration: Visual Studio integrates with popular version management systems like Git and Subversion, helping developers easily manage source code and work together on complex projects. User Interface Design Tools: Visual Studio comes with interactive user interface design tools, allowing users to create direct interfaces for their applications. Can create Windows Forms, WPF, ASP.NET applications, and mobile applications. Community and support: Visual Studio has a large and rich community that provides documentation, tutorials, tips, and techniques that help users get the most out of the platform's features. Users can search for information on Microsoft's official website, join forums, join user communities, and even exchange information via social networking platforms. Third-party extensions and sharing: Visual Studio Supports third-party extensions and sharing through add-ons and plugins. Users can download and install add-ons from the Visual Studio extension store to enhance features and customize them to their needs. Visual Studio Code: In addition to the full version of Visual Studio, Microsoft also offers Visual Studio Code (VS Code), a lighter and cross-platform version of the IDE. VS Code is an open-source editor that offers many of the same features as Visual Studio, but file-focused integration with web development tools and popular programming language variables. Versions and licenses: Visual Studio comes in different editions, including Community (free), Professional, and Enterprise editions. Each version has different features and limitations. Licenses to use Visual Studio are regulated by Microsoft and may require fees or special licenses depending on the intended use and project type. Visual Studio has become one of the most popular development tools in the software industry, with the support and contributions of an expanding community of developers worldwide. It provides a powerful environment for cross-platform application development and is customizable to meet the specific requirements of each project.
  • 24. 23 3. Solve real problems with algorithms. 3.1 Problem of finding prime numbers in a given range First, let's pose the problem: The problem of finding prime numbers is a classic problem in mathematics and programming. The goal of the problem is to find prime numbers in a given range. A prime number is a number that has only two positive divisors, 1 and itself. Those are numbers that cannot be divisible by any other positive integer without remainder. To solve the problem of finding prime numbers, we can use some methods such as: 1. Check each number in the given range: Iterates each number from 2 to the given range. Checks if the number is divisible by any number from 2 to the square root of that Number. If yes, then the number is not prime. If no divisible number is found, the number is prime and is printed. 2. Sieve of Eratosthenes: Create a list of numbers from 2 to the given range. Starting with the number 2, remove all multiples of 2 (except 2). Next, select the next number that is not discarded and discard all its multiples. Repeat the process until you have gone through all the numbers in the list. The remaining numbers in the list are primes and are printed.
  • 25. 24 After posing the problem, we draw a flow diagram for the problem. Figure 15. Flowchart of the problem of finding prime numbers.
  • 26. 25 4. Workaround (M1). Explain in detail how to solve problems in c# language. ‘ Figure 16. Function The above code is a source code in C# language to check if a number is prime or not. Here is a detailed explanation of each part of the code: 1. Declared namespace testing: This is a way to group functionally related components together. In this case, we use namespace testing to define a namespace in the source code. 2. Declare the Program class: This is the class containing the Main method and the IsPrime method.
  • 27. 26 3. IsPrime method: This is the method used to check if a number is prime or not. This method takes an integer number as an argument and returns a bool value. In this method, we have the following steps Check if number is less than 2. If less than 2, i.e. the number is not prime, the method returns false. Use a for loop to iterate from 2 to the square root of the number. In the loop, check if number is divisible by any number from 2 to square root. If yes, i.e. the number is not prime, the method returns false. If no divisible number is found, i.e. the number is prime, the method returns true. Figure 17. Main method Main method: This is the main method of the program. In this method, we have the following steps: 1. Console.WriteLine("Find prime numbers within a given range");: This line displays a message on the console to inform the user about the purpose of the program.
  • 28. 27 2. Console.Write("Enter the upper limit of the range: ");: This line prompts the user to enter the upper limit of the range. 3. int limit = int.Parse(Console.ReadLine());: This line reads the user's input from the console, which represents the upper limit of the range, and assigns it to the limit variable. int.Parse() is used to convert the user's input from a string to an integer. 4. Console.WriteLine("Prime numbers within the range from 2 to {0} are:", limit);: This line displays a message on the console to inform the user about the range for which prime numbers will be found. The {0} is a placeholder that will be replaced with the value of limit. 5. for (int i = 2; i <= limit; i++): This for loop iterates over each number from 2 to the limit entered by the user. 6. if (IsPrime(i)): This line checks whether the current number i is prime by calling the IsPrime method. If the IsPrime method returns true, it means the number is prime. 7. Console.WriteLine(i);: If the number is prime, this line prints the current number i on the console, as it is within the prime number range. 8. After the loop finishes, Console.ReadLine(); is used to keep the console window open until the user presses Enter, allowing them to see the output before the program exits. Overall, the Main method prompts the user for the upper limit of the range, finds and prints all prime numbers within that range using the IsPrime method, and then waits for the user to press Enter to exit the program. 5. Debug. To debug the program and identify any potential issues or errors, you can follow these steps: 1. Set breakpoints: Set breakpoints in the code by clicking on the left margin of the line of code you want to stop. The breakpoint will appear as a red dot. A breakpoint allows you to pause the program at that point to check the value of the variable and the execution. 2. Select Debug mode: Before running the program, select Debug mode instead of Run mode. You can select Debug mode by pressing F5 or selecting Debug > Start Debugging from the menu.
  • 29. 28 Figure 18. debug 3. Debugging and Fixing: When you encounter an error or problem in your program, use the debug information to determine the cause and correct the error. You can tweak the code, change the value of a variable, or use other debugging tools in Visual Studio to solve the problem. Once completed and no more errors, the program will run normally as expected
  • 30. 29 6. Test case Figure 19. Test cast 1 Test cast 1. input is 100 then output is as expected
  • 31. 30 Figure 20. test cast 2 Test cast 2. If the input is 1, the program will not give any result use a do-while loop to request re-entry if the input doesn't fit the program
  • 32. 31 first declare variable 'number' then in 'do-while' loop assign variable 'number' = variable 'limit'. next set condition for 'while' 'while (number < 2);' The block inside the do-while loop will be executed first. Then the do-while loop will check the conditional expression, if the conditional expression is true, the program will continue to execute the block in the do-while, otherwise, if the conditional expression is false, then stop the loop. The do-while loop is different from the while loop in that the while loop will check the condition first, while the do-while loop will execute the block first, so the block in the do-while will be executed at least once. so when the variable 'number' < 1 the program goes back to execute the statement in the 'do-while' loop Figure 21. test cast again
  • 33. 32 7. step by step from coding to running each program. Here are the steps from writing the code to running the program: Step 1: Define requirements and design: The first step is to define the main requirements and general design of the program. This includes defining functionality, data structures, user interfaces, and other key components. Step 2: Code: Once the requirements and design have been defined, you can start writing the source code. Writing code involves using a programming language and supporting tools to create source code files (.cs in C#) containing functions, classes, and data structures. Step 3: Syntax check: Before running the program, be sure to check the syntax of the source code to make sure it follows the rules and context of the programming language. You can use a compiler or an integrated development environment (IDE) syntas-checking tool to do this. Step 4: Compilation: The next step is to compile the source code into executable machine code. The compiler will convert the source code into an executable file (.exe or .dll file in C#) or intermediate code (in the case of compiled languages like C#). Step 5: Run the program: Once the code has been compiled, you can run the program by starting the corresponding executable. The program will start executing and performing the actions defined in the source code. Step 6: Testing: During the running of the program, test the functions and determine if the program works as expected. You can use predefined test scenarios and test cases to confirm the correctness and performance of the program. Step 7: Debugging and Fixing: If you encounter errors or problems during testing, use debugging tools to determine the cause and location of the error. Use tools such as the compiler, the IDE's built-in debugger, or a separate debugging tool to monitor variable values, view error messages, and investigate program flow. Once you have located the error, you can repair the source code to fix the problem.
  • 34. 33 Step 8: Retest: After fixing the error, run the test cases again and test the program again to make sure that the error has been fixed and the program works as expected. Step 9: Deployment: If the program has matured and passed the testing process, you can deploy it for use in a real environment. Deployment may include packaging the program, installing it on a computer or server, and verifying that the program works properly in the deployment environment. Step 10: Maintenance: Once the program has been deployed, the next task is to maintain and repair the program as needed. This includes handling errors that arise from the user or the environment, improving functionality, and ensuring the stability and performance of the program in the long run. The process from writing code to running the program is a relatively sequential series of steps, but there can be overlap and repetition between the different steps. It is important to maintain a careful process to ensure the quality and performance of your program. 8. Check the algorithm implementation in C# language To check the algorithm implementation in C# language, you can use the following steps: 1. Define test cases: Define the test cases that you will use to test the algorithm. Make sure to choose test cases that represent the special and boundary cases of the algorithm. 2. Write test code: Using C# language, write source code to execute test cases and check the results of the algorithm. You can use automated test methods like NUnit, MSTest, or xUnit to write and run test suites. 3. Test Run: Run test suites to execute the defined test cases. Check the results returned by the algorithm and verify that they are as expected. Using automated testing methods will make it easier for you to identify errors and gain a better understanding of how your algorithm is implemented. 4. Debug and fix errors: If the tester detects an error or incorrect results, use debugging tools to determine the cause and location of the error. Use tools such as the IDE's built-in debugger (Integrated Development Environment) to monitor variable values and investigate program flow. Then fix the error and run the test suites again to make sure that the algorithm is working properly. 5. Performance testing: If necessary, you can also test the algorithm's performance by measuring execution time and using performance measurement tools like StopWatch in C#.
  • 35. 34 Testing the algorithm implementation in C# language is very important to ensure the correctness and performance of the program. By performing tests and using supporting tools, you can ensure that your algorithm works properly and gives accurate results. 9. Evaluate the relationship between writing algorithms and using variables in the program. The relationship between writing algorithms and using variables in the program is very close and similar. Here are some reviews of this connection: 1. Come up with an algorithm: Writing an algorithm requires you to define the steps that need to be taken to solve the problem. In the process, you need to define the variables to use to store the data, intermediates, and results. Identifying the right variables is necessary for the algorithm to function properly. 2. Using variables in algorithms: When writing algorithms, you will use variables to store and process data. Variables will hold the values of the elements, perform calculations, and store the state of the algorithm. The correct and reasonable use of variables will ensure the correctness and efficiency of the algorithm. 3. Manage and track variables: During the implementation of an algorithm, you need to manage and monitor variables to ensure that they have valid and expected values. You need to initialize variables, and assign and update their values as required by the algorithm. It is important to check the validity of the variable value before using it to avoid unexpected errors. 4. Optimizing variable usage: Optimizing variable usage is important to reduce memory usage and increase program performance. You need to consider getting rid of unnecessary variables, using variables with appropriate data types, and optimizing the way variables are accessed and manipulated. This reduces the load on the memory and increases the execution speed of the algorithm. 5. In short, writing algorithms and using variables in the program are closely related. Identifying and using the right variables is important to solving problems correctly and effectively. At the same time, the management, monitoring, and optimization of variable usage also play an important role in ensuring the correctness, performance, and optimization of the algorithm. In the process of writing an algorithm, you need to define the variables needed to store the information, the intermediary, and the result of the algorithm. Using variables correctly and rationally helps to ensure the correctness of the algorithm and achieve the desired results.
  • 36. 35 In addition, it is important to manage and track variables during algorithm implementation. You need to initialize, assign and update the values of the variables as required by the algorithm. Also, checking the validity of the variable value before use helps to avoid unexpected errors. Optimizing variable usage also plays an important role. You need to consider getting rid of unnecessary variables, using the right data types, and optimizing the way variables are accessed and manipulated. This reduces the load on the memory and increases the execution speed of the algorithm. In summary, writing algorithms and using variables in the program are closely related and similar. The identification, use, management, and optimization of variables play an important role in ensuring the correctness, performance, and optimization of the algorithm.
  • 37. 36 III. Conclusion. In this essay, I will start by introducing the concept of algorithms. I will explain what algorithms are and how important they are in solving problems effectively. To illustrate this concept, I will provide an example of an algorithm by describing the steps involved in completing a task, such as baking a cake or preparing a meal. This will help demonstrate how algorithms are used in everyday life to solve specific problems. I then present a problem to be solved, along with a flowchart. Problems can range from solving quadratic equations to developing computer software or applying simple multiple-choice tests. Program development steps Next, I will outline the steps involved in developing a program. I will explain the following stages: Defining: This involves understanding the problem and its requirements, as well as defining the program's inputs, outputs, and constraints. Design: In this phase, I create a plan or blueprint for the structure of the program, including algorithms, data structures, and the user interface. Code: Here, I write the actual code in a programming language like C#, translating algorithms and designs into executable instructions. Documentation: Proper documentation is essential to maintaining and understanding the program. I will stress the importance of documenting the code, including comments and explanations. Compile and run: After the code is written, I compile it into machine-readable instructions and execute the program to observe its behavior. Testing and debugging: I will discuss the importance of testing a program to ensure its correctness and reliability. I will also explain the process of identifying and correcting bugs or errors in the code. Maintenance: Programs require ongoing maintenance to resolve problems, add new features, and adapt to changes. I will emphasize the need for regular updates and improvements to ensure the program remains effective.
  • 38. 37 Solve problems with algorithms. In this section, I will explore how algorithms can be applied to solve problems efficiently. I will provide detailed explanations and source code examples to demonstrate how to solve specific problems with algorithms. I will also discuss program interface design, including graphical user interfaces (GUIs), and explain how to create user-friendly and visually appealing interfaces for a better user experience. Furthermore, I'll dive into the concept of functions and their role in modularizing code, improving code organization, and promoting code reuse. I will emphasize the importance of debugging techniques in identifying and resolving errors or problems in a program. I will discuss different debugging tools and strategies to debug code efficiently. Finally, I will discuss the importance of test cases in verifying the correctness and robustness of a program. I will explore different types of test cases and their role in making sure the program works as expected. Define the steps from coding to execution I will provide a comprehensive overview of the steps involved in coding and executing a program. This will include activities such as coding, compiling, linking, and running the program. Evaluation of algorithm implementation and variable usage in C# I will examine the implementation of algorithms in the C# programming language. We will evaluate the relationship between algorithm design and the use of variables in the program. This review will emphasize the importance of using the right variables to ensure the accuracy and efficiency of the algorithm. In summary, this essay covers various aspects related to algorithms, program development, problep- solving techniques, and the use of variables. By understanding these concepts and following the steps outlined, developers can create well-designed, efficient, and reliable programs that effectively solve real-world problems.
  • 39. 38 IV. Reference list. [1]. Stages of program development process (Program development steps) || CseWorld Online. [online] Available at: https://www.cseworldonline.com/articles/stages-of-program- development-process.php [2]. Prabhu, R. (2019). Introduction to Algorithms. [online] GeeksforGeeks. Available at: https://www.geeksforgeeks.org/introduction-to-algorithms/ [3]. How Algorithms Are Used for Problem Solving in Psychology. [online] Verywell Mind. Available at: https://www.verywellmind.com/what-is-an-algorithm-2794807 [4]. Carneiro, B. (2022). Java code without any workaround. [online] GitHub. Available at: https://github.com/Tautorn/java-code-without-any-workaround/blob/master/README.md