Docsity

Assignment 1 Programming - 1618 subject, Essays (university) of C programming

Toggle sidebar
bg1
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
Phạm Hoàng Gia Khang
Student ID
GCS210702
Class
GCS1002
Assessor name
Nguyễn Tuấn Đăng
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
M1
D1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download Assignment 1 Programming - 1618 subject and more Essays (university) C 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 Phạm Hoàng Gia Khang Student ID GCS

Class GCS1002^ Assessor name Nguyễn Tuấn Đăng

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:

Table of figures:

Figure 1: Introduction of Algorithm .................................................................................. 4 Figure 2: Flowchart of example .......................................................................................... 6 Figure 3: Coding of Bubble Sort ......................................................................................... 9 Figure 4: Menu system ...................................................................................................... 11 Figure 5: Add Book ............................................................................................................ 12 Figure 6: Search book ........................................................................................................ 13 Figure 7: Main Menu Hub ................................................................................................ 15 Figure 8: Software Development Life Cycle .................................................................... 20

Chapter 1:

1 .1/ Overview of Algorithm

Definition: An algorithm (pronounced AL-go-rith-um) is a method or formula for resolving a problem by following a set of steps. An algorithm can be thought of as a computer program. An algorithm is a simple process that solves a repeated mathematics and computer science issue.

Algorithms are frequently employed in many aspects of information technology (information technology). For instance, a search engine algorithm accepts keyword and operator search strings as input searches its associated database for relevant websites and provides results.

Figure 1: Introduction of Algorithm (Source: Introduction to Algorithms - GeeksforGeeks)

Algorithm properties:

An algorithm would consist of the following components:

  • Accuracy: It is the most critical component in achieving successful outcomes and operations.
  • Clarification: The method is based on the commands. As a result, the algorithm should be presented in a clear, easy-to-understand manner and a certain order.
  • Universality: The algorithm must be very applicable. It is utilized to solve a wide range of issues, not just specific ones.
  • Objectivity: The algorithm, no matter how it is implemented, always yields only one answer. If there is a different answer from the person who implements the algorithm or the computer, it should be reconsidered.
  • Termination: Because an algorithm is a finite set, it always has an endpoint, as shown in the What is an algorithm section. When a match is discovered, this is interpreted as the endpoint. Some algorithms:

There are many algorithms, such as: For almost any kind of math problem to solve  Numerical algorithms.  Algebraic algorithms.  Geometric algorithms.  Sequential algorithms.

d = b^2 – 4ac

Step 4: In case d > 0, x1= - b +^ √ 2adelta , x2=-b^ -^ √ 2adelta

Step 5: In case d = 0, x1=x2=

  • b 2a

Step 6: Print x1 and x

Step 7: In case d < 0, print “the equation has no solution”.

Step 8: End.

Figure 2: Flowchart of example

Characteristic of Algorithm:

a) Input Specified

The Input is the data to be transformed during the computation to produce the output. An algorithm should have 0 or more well-defined inputs. Input precision requires that you know that kind of data, how much, and what form the data should be.

b) Output Specified

The output is the data resulting from the computation (your intended result). An algorithm should have 1 or more well-defined outputs and match the desired output. Output precision also requires that you know what kind of data, how much and what form the output should be (or even if there will be any output at all!).

c) Definiteness

Algorithms must specify every step and the order in the steps must be taken in the process. Definiteness means specifying the sequence of operations for turning input into output. The algorithm should be clear and unambiguous. The detail of each step must be also be spelled out (including how to handle errors). It should contain everything quantitative and not quantitative.

d) Effectiveness

For an algorithm to be effective, it means that all those steps that are required to get to output must be feasible with the available resources. It should not contain any unnecessary and redundant steps which could make an algorithm ineffective.

e) Finiteness

The algorithm must stop, eventually. Stopping may mean that you get the expected output or you get a response that no solution is possible. Algorithms must terminate after a finite number of steps. An algorithm should not be infinite and always terminate after a definite number of numbers.

f) Independent

Figure 3: Coding of Bubble Sort

Chapter 2:

2.1: Analyse the problem

To manage a book library, we need a complete and efficient system. The first is a menu map, and there are many options in it. The application have these following functions: Input number of book, Display, Search, and Exit.

  • Input number of the book:

First of all, to manage the library book management, In Input, users will have to insert important information, including Title, Name of Book, Name of Author, Year of Publication,…

  • Display:

After the user inserted the required information, The system will save and output to the screen when this command is pressed.

  • Search:

“Search” will help users find information, such as finding the name of the book, name of the author, year of publication,…

  • Exit:

Finally, when users finished the system the library management, “Exit” is used to quit the system.

2.2/ Flowchart:

Figure 5: Add Book

Figure 6: Search book

Figure 7: Main Menu Hub The main menu hub in the program will have a do-while loop and switch-case. Its mission is to let users choose which options they want, with options from 1 to 6, in case users don’t insert the given numbers, the system will return to the main menu.

ADD BOOKS

Source code:

DISPLAY

Source code:

Now you can see, after entering the required information, the system will save your data and when you want to see your data, the system will appear the information throughout case 2 “Display”.

SEARCHING BOOKS

Source code:

The option “Search book” will be tackled when you want to find the name of the book or the name of the author, the system will find the information that you enter previous time, if your searching data is equal to the system data, the result will appear.