programming and basic c#, Assignments of Programming Paradigms

assignment of btech hnd first sem of programming

Typology: Assignments

2020/2021

Uploaded on 05/31/2021

anish-devkota
anish-devkota 🇳🇵

4.8

(8)

4 documents

1 / 85

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Contents
Section A...................................................................................................................................................... 3
Report...................................................................................................................................................... 3
Introduction to Algorithm....................................................................................................................4
Characteristics of Algorithm................................................................................................................ 5
Advantages:.........................................................................................................................................5
Disadvantages:.....................................................................................................................................5
Examples of Algorithm with flowchart and its working.......................................................................5
Outline process of developing application........................................................................................... 7
Development environment..................................................................................................................8
Programming Language.......................................................................................................................8
Platform environment......................................................................................................................... 9
Inventory management system design layout....................................................................................9
Design forms of inventory system created in visual studio 19:..........................................................10
Data dictionary:................................................................................................................................. 13
Algorithm and flowchart of application.............................................................................................14
Code execution process..................................................................................................................... 18
Implementation of algorithm................................................................................................................ 19
Relation between algorithm and source code:..................................................................................21
Section B.................................................................................................................................................... 21
Introduction to Procedural Oriented language......................................................................................21
Features of Procedural Oriented Language........................................................................................... 21
Limitations of Procedural Oriented Language.......................................................................................22
Function of Procedural Oriented programming..................................................................................... 22
Basic I/O............................................................................................................................................. 22
Control Statement............................................................................................................................. 22
Looping..............................................................................................................................................26
Array..................................................................................................................................................28
Structure............................................................................................................................................ 29
Function............................................................................................................................................. 30
Pointer...............................................................................................................................................31
String..................................................................................................................................................31
File handling.......................................................................................................................................31
1 | P a g e
ANISH DEVKOTA (BTECH HND/ first semester)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55

Partial preview of the text

Download programming and basic c# and more Assignments Programming Paradigms in PDF only on Docsity!

Contents

REPORT ON ALGORITHM AND

ITS APPLICATION

DEVELOPMENT PROCESS

Anish Devkota BTECH HND Introduction to Algorithm Algorithm is known as a rule or procedure followed for performing calculations and other specific tasks. Algorithm in programming can be defined as the sequence of instruction that 4 | P a g e

helps in solving various problems through step wisely.” An algorithm is the list of instructions and rules that a computer needs to do to complete a task” [ CITATION Thi \l 1033 ]. Algorithm also describes the exact steps to be followed by system to reach the main goal. Simply, algorithms command the computer system how to do the task and make it work according to the command. “A standard textbook definition would be – an algorithm is a well-defined step by step solution or a series of instructions to solve a problem.”([ CITATION Pri \l 1033 ] Algorithm consists steps like; Problem definition, data collection, data processing, logical approach, solution. Therefore, Programming algorithm is written in simple language and it is not a computer code. Algorithm is a simple human language which has a similarity to pseudocode. Characteristics of Algorithm

  1. Algorithm knows the exact and correct steps to execute.
  2. Algorithm ends by giving the expected result after execution of finite instructions
  3. Every process is described clearly
  4. Algorithm might contain zero or more well defined inputs and gives 1 or more well defined outputs. Algorithm always give the direction to solution and helps to choose most ideal result. After writing algorithm, flowchart is designed following it and lastly program is build. As, flowchart is the sequential presentation of any program in a diagrammatic form. Advantages:  Algorithm can be used for different meaningful task that can be instructed for logical representation.  Understood able to everyone and written easily.  Algorithm is also easy to convert into a flowchart and program.  It is easy to debug as every step has its own logical sequence. Disadvantages :  It is time consuming because of steps for producing it into program.  It is not executable in the programming language  No syntax to write an algorithm.  Error detection cannot be easily achieved. Examples of Algorithm with flowchart and its working a. Making an algorithm of simple login process; Step 1: Start Step 2: Input the username and password Step 3: Check the username and provided password Step 4: display invalid for incorrect and move to step 2 but move to step 5 for correct one Step 5: Display the dashboard after login 5 | P a g e

Algorithm; Step 1 = start Step 2 = enter two numbers Step 3 = check if a>b Step 4 = if not true display b is greater and if true display a is greater Step 5 = end Working: here, user will input two numbers, then condition of greater will be checked. After being checked, the system will give the number which is greater. Outline process of developing application This is a type of process/steps used by the software development offices or industries to make a software application. This also helps in understanding the main goal and cycle of software development. This process mainly defines the activities followed or to be followed for producing the suitable application. Simply, this can be known as the process in building successful application. The major steps in this process are:  Planning and requirement analysis: Firstly, to build an application there must be good understanding of the system requirements. The main aim or goal must be well known and the planning must be done according to the possible and effective paths to be followed by the developers. During this planning, the requirements also must be fulfilled. Lastly, defining the requirement and planning for it is done in this process.  Designing: After knowing the requirements and plan to implement for building successful application, the system design must be prepared. It clearly defines all the architectural modules of the system. This step/process can also be mentioned as sketching of the planned application. 7 | P a g e

 Building or developing product Being able to know the requirements and plans to work for it, design was prepared. Now, the building process of the system will be started The system is developed after evaluating the produced design in a small programs called unit. Then after testing the final product is developed.  Testing the product: When the application is built successfully, then there will be the final testing. Meet of requirement, user friendliness, understood designing etc. are checked. After being checked and the application will be deployed in market. Checking the functionality according to the client’s demand is done in this process.  Deployment in market: The product will be deployed in a market for the clients/customers. This is also the first stage of the production to the market. The final product after testing and evaluating is deployed in the market.  Maintenance After successful deployment, maintenance of the application must be done by the developers. Based on the client’s feedback the application must be improved and maintained up to date. This also helps in development of the application and popular to the market. Adding the new features and capabilities is also done in this process. Development environment Development environment is defined as the process or tools used for developing the source code or program involved in making application. Environment where tools and set of rules are coordinated for developers to provide convenient and systematic view of the development process is integrated development environment. Talking personally, our team have used Visual Studio 19 as my developing environment for successfully building the required application/system. Being easier to use and debug, visual studio was found to be more favorable for us as an application developer. Some more feature by using this development environment are:

  • Easy in debugging the code
  • This environment was favorable for editing source code and different scripts.
  • This also help in transforming source code into computer language Programming Language A set of commands used for creating a software program is called programming language.” A programming language is a computer language that programmers use to develop software programs, scripts or other sets of instructions for computers to execute.”[ CITATION Com \l 1033 ] Therefore, there are various programming languages and all share the similarities of functioning but with own syntax. Some of the popular languages are; C, C++, C#, JavaScript, CSS, Python etc. As, our team were known to the c, C++, C# languages. For our application building process, we have used C# language. We used this language because it is much easier to use syntax wisely than c and C++. C# is also known to be object oriented 8 | P a g e

Design forms of inventory system created in visual studio 19: 10 | P a g e Login  Purchase  Sales  Purchase report  Sales report  Category  Unit  Product  Customer  Supplier Setup Transaction (^) Reports Dashboard

11 | P a g e

Data dictionary: Below is the data dictionary of our required application: User: S.N Column Name Data type Constraint Remarks 1 User Id Int Primary key Unique Id 2 User name Varchar(50) Not null Name of user to login 3 Email Varchar(50) Not null Email of user 4 Password Varchar(50) Not null Password of user 5 Phone Varchar(50) Not null Contact number of user Customer Supplier: S.N Column Name Data type Constraint Remarks 1 Customer/Supplier Id Int Primary key Unique Id 2 Customer/Supplier name Varchar(50) Not null Name of Customer/Supplier 3 Email Varchar(50) Not null Email of Customer/Supplier 4 Password Varchar(50) Not null Password 5 Phone Varchar(50) Not null Contact number Category: S.N Column Name Data type Constraint Remarks 1 Category Id Int Primary key Unique Id 2 Category name Varchar(50) Not null Name of category 3 Category type Varchar(50) Not null Type of category 4 Remarks Varchar(50) Not null Remarks for category Unit: S.N Column Name Data type Constraint Remarks 1 Unit Id Int Primary key Unique Id 13 | P a g e

2 Unit name Varchar(50) Not null Name of Unit 3 Alias Varchar(50) Not null Also known as name Product: S.N Column Name Data type Constraint Remarks 1 Product Id Int Primary key Unique Id 2 Product name Varchar(50) Not null Name of user to login 3 Rate money Not null Email of user 4 Quantity Int Not null Password of user 5 Unit Id Int Foreign key From unit 6 Category Id Int Foreign key From category 7 Customer Supplier Id Int Foreign key From Customer Supplier Transaction master: S.N Column Name Data type Constraint Remarks 1 Transaction Id Int Primary key Unique Id 2 Customer Supplier Id Int Foreign key From customer Supplier 3 Transaction date date Not null Date of transaction 4 Type Nvarchar(10) Not null Type 5 Grand Total Decimal(18,0) Not null Total transaction amount 6 Tax Decimal(18,0) Not null Tax in any product 7 Discount Decimal(18,0) Not null Discount in product Transaction detail: S.N Column Name Data type Constraint Remarks 1 Transaction detail Id Int Primary key Unique Id 2 Transaction Id Int Foreign key From transaction master 3 Product Varchar(50) Not null Name of product 4 Quantity Int Not null Quantity of product 5 Rate Money Not null Rate from product 6 Total Decimal(18,0) Not null Total amount of product The above table shows the type of data used in our system for different attributes of a different tables. Algorithm and flowchart of application Below is the algorithm and flowchart modules of our designed application.

  1. Algorithm and flowchart for the Login button Step 1: Start Step 2: Input the username and password 14 | P a g e
  1. Algorithm and flowchart for saving product data in product table Step 1: Start Step 2: Enter data of product to store Step 3: Click save button for saving the data Step 4: Check for the valid data according to the data types Step 5: Display data saved successfully for valid entry Step 6: Display invalid for Incorrect entry Step 7; Stop Flowchart: 16 | P a g e
  1. Algorithm and flowchart for deleting any components of table using delete button Step 1: Start Step 2: Click delete button Step 3: Check for the confirmation of user Step 4: If user gives yes then delete and end if no Step 5: Ask for changes in database or not Step 6: If yes delete the selected component Step 7: If no is selected then display error message Step 8: stop Flowchart: 17 | P a g e

preprocessed, compiler will compile the code into object codes (obj. o) then the linker links the compiled object codes with other library codes and make the code in executable form. Then the loader will load the final executable code into the machine and lastly the output of source code is displayed.  Source code: “Source code is the list of human readable instructions that a programmer writes often in a word processing program when he/she is developing a program.”[ CITATION Dav19 \l 1033 ]. Source code must be converted into machine level code because this is only readable and understood by human not machine. It is processed through compiler to turn into machine code that is known to computer.  Preprocessor The preprocessor directives give instruction to the compiler to preprocess the information before actual compilation starts. All preprocessor directives begin with #, and only white- space characters may appear before a preprocessor directive on a line. Preprocessor directives are not statements, so they do not end with a semicolon (;)” [ CITATION tut \l 1033 ].  Assembler/Compiler The assembler is a process of documenting or converting all the source code into machine level code. Here, the source code is converted into the binary form which is understood to the computer and produce an executable code. Assembler is also referred as a compiler of assembly language which provides services or interpreter.  Linker The linker links the compiled object codes with other library codes and make the code in executable form. This is also called as final stage of compilation process. It makes the input from user as one and produce to the loading process.  Loader Loader is considered as the final stage of program. Here, the code is executed into the main memory. This is the responsible factor for loading the executable files into the system’s memory. Loader also helps in validate program for memory requirements, permission, initializing the registers etc.  Memory This is the final step of execution of any program in computer. Here the program conducted in a machine is saved. The process from source code and loader including its product is saved in memory. In a computer while executing a program, RAM is responsible for the time of producing the final product and ROM is responsible for keeping or storing the final product. Implementation of algorithm Hereby after knowing the algorithm of any sort of program we can create a source code for it to apply in program. Algorithm also helps in the code writing and designing process. Understanding of the process of code is also understood by flowchart and algorithm. Below is the implementation of a program with algorithm and flowchart and program written following C language. 19 | P a g e

Question: Find the simple interest from the number. Algorithm; Step 1= start Step 2= get the value of principle, time and rate Step 3= calculate with the process (PTR)/ Step 4= display the value of interest Step 5= end Flowchart; Code written in Dev C++ following the C language method: 20 | P a g e