Assignment 1 Programming (1618 Distinction)

36 2 0
Assignment 1 Programming (1618  Distinction)

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Bài này này giới thiệu cho sinh viên các khái niệm cốt lõi của lập trình cùng với phần giới thiệu về các thuật toán và đặc điểm của mô hình lập trình. Trong số các chủ đề trong phần này bao gồm: giới thiệu về thuật toán, lập trình hướng đối tượng và hướng sự kiện, các cân nhắc về bảo mật, môi trường phát triển tích hợp và quy trình gỡ lỗi.

ASSIGNMENT FRONT SHEET Qualification BTEC Level 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 Bui Quang Minh Student ID GCD210325 Class GCD1104 Assessor name Ly Quynh Tran Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism I understand that making a false declaration is a form of malpractice Student’s signature Grading grid P1 M1 D1  Summative Feedback: Grade: Lecturer Signature: Assessor Signature:  Resubmission Feedback: Date: Table of Contents CHAPTER 1: STATE SIMPLE BUSINESS PROBLEMS I INTRODUCTION II ALGORITHM Definition Explaination 2.1 Characteristics of an algorithm 2.2 Properties of algorithm 2.3 Types of an algorithm Examples of algorithms 10 III REPRESENT PROBLEM 12 Sorting algorithm 12 Searching algorithm 13 CHAPTER 2: ANALYSE PROBLEM AND DESIGN SOLUTIONS 14 I ANALYSE BUSINESS PROBLEM 14 Analysing 14 Library 14 Data types and properties 14 II USE-CASE DIAGRAM 15 III FLOWCHART 16 Function of selecting menu function 16 Function of showing all books 17 Function of importing a new book 18 Function of searching books 19 Function of borrowing a book 21 Function of showing all clients 22 CHAPTER 3: DEMONSTRATE AND RUNNING A PROGRAM 23 I CODING STANDARD 23 Show all books 23 Import a new book 24 Search books 25 Borrow a book 27 Show all clients 28 Close the library 28 II RESULTS OF PROGRAM 29 Show all books 29 Import a new book 29 Search books 30 Borrow a book 31 Show all clients 31 Close the library 32 III SOFTWARE DEVELOPMENT LIFE CYCLE (SDLC) 32 Definition 32 The entire SDLC process 32 CHAPTER 4: EVALUATION 35 I TEST CASE 35 II EVALUATION …… .……… 36 REFERENCE LIST ………………………………………………………………………………………………………………………………… 37 CHAPTER 1: STATE SIMPLE BUSINESS PROBLEMS (P1) I INTRODUCTION A software development business invited me for an interview after I applied for a position as a trainee there I've been asked to display my skills and ability for solving issues and for simple programming I must first write a report on employing algorithms to solve problems in order to this I must clarify, with the help of examples, how algorithms are used to resolve straightforward business issues as well as the procedures that must be followed in order to create software that solves the issue I should clarify the idea I have about your software Input, output, and assignment statements, loops, and conditional statements are all fundamental procedural programming constructs that will be used to solve the issues Utilizing flowcharts and modules, problems should be analyzed, created, and shown II ALGORITHM Definition The word Algorithm means ”A set of finite rules or instructions to be followed in calculations or other problem-solving operations ” Or ” A procedure for solving a mathematical problem in a finite number of steps that frequently involves recursive operations” 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 hardwareor software-based routines Algorithms are widely used throughout all areas of IT In mathematics and computer science, an algorithm usually refers to a small procedure that solves a recurrent problem Algorithms are also used as specifications for performing data processing and play a major role in automated systems Figure What is algorithm Explaination 2.1 Characteristics of an algorithm Figure Characteristics of an algorithm Clear and Unambiguous: The algorithm should be clear and unambiguous Each of its steps should be clear in all aspects and must lead to only one meaning Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs It may or may not take input Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well It should produce at least output Finite-ness: The algorithm must be finite, i.e it should terminate after a finite time Feasible: The algorithm must be simple, generic, and practical, such that it can be executed with the available resources It must not contain some future technology or anything Language Independent: The Algorithm designed must be language-independent, i.e it must be just plain instructions that can be implemented in any language, and yet the output will be the same, as expected 2.2 Properties of algorithm      It should terminate after a finite time It should produce at least one output It should take zero or more input It should be deterministic means giving the same output for the same input case Every step in the algorithm must be effective i.e every step should some work 2.3 Types of an algorithm There are several types of algorithms available Some important algorithms are: Brute Force Algorithm: It is the simplest approach for a problem A brute force algorithm is the first approach that comes to finding when we see a problem Recursive Algorithm: A recursive algorithm is based on recursion In this case, a problem is broken into several sub-parts and called the same function again and again Backtracking Algorithm: The backtracking algorithm basically builds the solution by searching among all possible solutions Using this algorithm, we keep on building the solution following criteria Whenever a solution fails we trace back to the failure point and build on the next solution and continue this process till we find the solution or all possible solutions are looked after Searching Algorithm: Searching algorithms are the ones that are used for searching elements or groups of elements from a particular data structure They can be of different types based on their approach or the data structure in which the element should be found Sorting Algorithm: Sorting is arranging a group of data in a particular manner according to the requirement The algorithms which help in performing this function are called sorting algorithms Generally sorting algorithms are used to sort groups of data in an increasing or decreasing manner Hashing Algorithm: Hashing algorithms work similarly to the searching algorithm But they contain an index with a key ID In hashing, a key is assigned to specific data Divide and Conquer Algorithm: This algorithm breaks a problem into sub-problems, solves a single sub-problem and merges the solutions together to get the final solution It consists of the following three steps: • Divide • Solve • Combine Greedy Algorithm: In this type of algorithm the solution is built part by part The solution of the next part is built based on the immediate benefit of the next part The one solution giving the most benefit will be chosen as the solution for the next part Dynamic Programming Algorithm: This algorithm uses the concept of using the already found solution to avoid repetitive calculation of the same part of the problem It divides the problem into smaller overlapping subproblems and solves them 10 Randomized Algorithm: In the randomized algorithm we use a random number so it gives immediate benefit The random number helps in deciding the expected outcome Examples of algorithms Real-life examples that define the use of algorithms: • Sorting Papers: A simple task and yet it uses algorithmic thinking When you are sorting office files or your personal documents you are implementing an algorithm In its most basic sense, you are following a set of tasks to achieve an outcome The reason why sorting papers is a great example, is because it shows the variety of tasks and specifications algorithms can use For instance, you can sort your files alphabetically, by word count, by date, and countless others The goal is to simplify the organizational process by using small tasks • Traffic Signals: The programming implemented in traffic signals considers real-time traffic flow and groups general sets of movements into phases For instance, traveling through a lane and turning right would be grouped into one phase In order to maintain safety, traffic lights need a smart algorithm that detects the phases and times the movement correctly Every time you pull up to a red light, the traffic signal is cycling through phases It is using an algorithm to determine the best time for you to continue through the intersection based on traffic volume “Algorithm to print all books in library” Algorithm solving process: Step 1: Start Step 2: Declare new class “Book” String Title String Author String Category String PublicationDate Step 3: Declare new List Step 4: Set all books’ information Step 5: Create first loop to print If true, print info of every single books if false, end the command Step 6: Create second loop to print the book’s status If true, print the person borrowing book if false, print this book is available Figure Flowchart of printing all books in library III REPRESENT PROLEM Today, the data of books and clients are increasing dramatically; therefore, having a library management application is really necessary The program requires a main menu based on requirements such as: Entering the book's information including title, author, category, and publication date, printing all books or clients, and other excellent functions this application will help the librarian increase work efficiency, and reduce time wasted This session will be mentioned next in chapter Sorting algorithm For Example, there are many algorithms for arranging a sequence of random numbers but still giving the same output The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it at the beginning Figure Selection Sort illustration

Ngày đăng: 02/02/2024, 09:49

Tài liệu cùng người dùng

Tài liệu liên quan