Download Programming ASM 1 Greenwich and more Thesis System Programming in PDF only on Docsity!
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 Quoc Trung Student ID GCD
Class GCD1102 Assessor name Nguyen Van Loi
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P1 M1 D
❒ Summative Feedback: ❒ Resubmission Feedback:
Grade: Assessor Signature: Date:
Lecturer Signature:
I. INTRODUCTION
1. Algorithm
- An algorithm is a procedure used for solving a problem or performing a computation.
Algorithms act as an exact list of instructions that conduct specified actions step by step
in either hardware- or software-based routines.
- All aspects of information technology employ algorithms extensively. A simple
technique that resolves a recurring issue is typically referred to as an algorithm in
mathematics and computer science. Algorithms are essential to automated systems
because they serve as specifications for processing data.
- An algorithm may be employed for simple tasks like sorting lists of numbers or for
more challenging ones like suggesting user content on social media. The starting input
and instructions for an algorithm's computation are often provided. When the
calculation is finished, an output is created.
2. How does algorithm work? - Natural languages, programming languages, pseudocode, flowcharts, and control tables can all be used to express algorithms. Expressions in natural languages are uncommon because they are more ambiguous. A computer's algorithms are typically expressed in programming languages. - An initial input and a list of instructions are used by algorithms. The input, which can be expressed as either words or numbers, is the first batch of information required to make decisions. The input data is subjected to a series of instructions, or calculations, which may include mathematical operations and judgment calls. The final step in an algorithm is called the output, and it is typically expressed as more data. - For instance, when a search query is entered, a set of instructions for searching a database for things that match the query are processed through the input of the search algorithm. Figure 1 : What is algorithm?
- Dynamic programming algorithm : By breaking down difficulties into smaller ones, this program finds solutions. The outcomes are then saved for use in solving related challenges in the future.
- Brute-force algorithm : By breaking down difficulties into smaller ones, this program finds solutions. The outcomes are then saved for use in solving related challenges in the future.
- Sorting algorithm : Sorting algorithms are used to change the order of data in a data structure depending on a comparison operator.
- Hasing algorithm : This algorithm takes data and hashes it to create a uniform message.
- Randomized algorithm : Running times and complexity dependent on time are decreased by this algorithm. Part of its logic includes random components. 4. Examples of algorithms - This article will be written in C#. The cross-platform nature of C# allows it to be compiled on a wide range of computer architectures (Windows, Linux, MacOS) Due to the usage of intermediate compilers (CLR), C# has great performance and quick execution speed. In addition, it has a faster rate of software development than the majority of modern languages. - To better understand the algorithm, we'll use the example of sorting numbers in order. We must first determine how many numbers the user will be required to enter. Here, we'll ask the user to input a string of numbers, each one separated by the space bar, and then create an array with those numbers in it. - For instance, if the user types a string like "4 5 7 3 2," the program will run and display "2 3 4 5 7" on the output screen. This is what our algorithm will produce as a consequence. - To better understand how it works, let's take a look at the flowchart of this article.
Figure 3 : flowchart example.
I. PROBLEM
1. Problem
- Entering the information and data for the books and printing that information is the
issue that needs to be resolved here. The name, author, name of producer, year of
publication, and price of the book will all be listed.
- To avoid any mistakes, we will carefully handle these situations.
2. Analyzes the problem
- In order to solve this issue, we must enter data such as: name, author, name of
producer, year of publication, and price of the book. Our strategy will result in a
list, each item of which will include a book's worth of material. We will start to
create a flowchart to comprehend the problem at hand from this study.
Figure 6 : Problem we need to solve
Figure 7 : Flowchart of program
To conveniently enter and show the information, we will first develop the Book class.
- Then create 4 methods include:
+Book(string name, string author, string producer, int yearPublish, price)
+Book()
+Input(): Enter book’s information.
+Display(): Display book’s information.
Figure 10 : Methods in class Book Figure 11 : Detail of methods in class Book
b) Class Program
- Program class will have 4 methods, which will be Input(), Display(), FindName()
and ShowMenu()
*Flowchart of ShowMenu()
Figure 12 : Flowchart of ShowMenu()
*Flowchart of Display()
Figure 14 : Flowchart of Display()
*Flowchart of FindName()
Figure 15 : Flowchart of FindName()
- I. INTRODUCTION
- Algorithm
- How does algorithm work?
- Types of algorithms
- Examples of algorithms
- I. PROBLEM
- Problem
- Analyzes the problem
- a) Class: Book..................................................................................................................................................
- b) Class Program..................................................................................................................................................
- III. HOW THE PROGRAM WORK
- Solve the problem
- Source code
- Program result
- What is Software Development Life Cycle
- How the source code is compiled
- REFERENCES
- Figure 1: What is algorithm?
- Figure 2: Types of algorithms
- Figure 3: flowchart example.
- Figure 4: Code example.................................................................................................................................................
- Figure 5: Result of code example
- Figure 6: Problem we need to solve
- Figure 7: Flowchart of program
- Figure 8: field in class Book
- Figure 9: Properties in class Book................................................................................................................................
- Figure 10: Methods in class Book
- Figure 11: Detail of methods in class Book
- Figure 12: Flowchart of ShowMenu()
- Figure 13: Flowchart of Input()
- Figure 14: Flowchart of Display().................................................................................................................................
- Figure 15: Flowchart of FindName()
- Figure 16: Menu of the program
- Figure 17: Source code
- Figure 18: Source code
- Figure 19: Source code
- Figure 20: Start a program...........................................................................................................................................
- Figure 21: Choose option
- Figure 22: Choose option
- Figure 23: Choose option
- Figure 24: Choose option
- Figure 18 : Source code
- Figure 19 : Source code