Procedures correspond to functions. Both allow the reuse of the same code in various parts of the programs, and at various points of its execution.
By the same token, procedure calls correspond to function application.
Functions and their invocations are modularly separated from each other in the same manner, by the use of function arguments, return values and variable scopes.
Decomposing of a big task into smaller tasks holds the concept of procedural programming. Procedures are called and some inputs are given into it to be processed, then these procedures process the data and gives output according to the logic of the program. Valid data is given to the function as arguments then valid data is the output of the function if it does not holds then the particular function can be checked.
Procedures corresponds to functions. Both allow the reuse of the same code in various parts of the programs and at various points of its execution. By the same token procedure call corresponds to the same token. Functions and their invocations are modularly separated from each other in the same manner by the use of function arguments, return values and variable scopes. It is a better approach that a function process its own set of data and not the same shared data or variables declared as global. It is good practice to make another procedure to do another task. And then this process can be called wherever we want that function to be executed. This enhances various factors of good programming like code reusability, code readability, easy debugging, etc.
Function:
Function is a subprogram which is used to enclose set of code which provides the ease of code reusability. Functions can be used in a place where calculations are to be performed or any logic is combined with the solution. It helps when you designs the logic once and uses it wherever you require. Functions can also take arguments and return values according to the logic but functions can only return one value whereas they can take as many as the require.
Ex: int square(int no)
{
return no * no;
}
Here square() function receives a number as argument and returns square of it.
Variables:
Variables are the identifiers which hold memory in the primary storage and they store values at the time of program execution and these values varies at the time of program execution.
Variable names should be meaningful in a program according to convention.
Rules to declare a variable name:
Ex: int price = 12000;
Loops:
Repetitive statement or group of statements are called as loops. They always contain some condition which is when true iterates and when it is false it stops iterating and goes to the next statement after the loop. There are two type of loops:
Entry control loop: Condition is checked first and then execution starts.
If the condition gives a false then it does not execute even a single time.
Exit Control loop: Condition is checked at last and if the condition then gives a false result then it stops execution. But it execute once always whether the condition is true or not.
For Loop:
for(int i = 0; i < 15; i++){
....
……
}
While loop:
int i = 10;
while(i != 0){
…
…
}
Benefits of Procedural Programming:
There are many benefits of procedural programming these are the following:
It helps us to divide the large task into multiple simple tasks that performs specific task.
In modular programming every task is defined as separate and independent task so our application can be changed any without changing other modules.
Benefits offered by modular programming to the programmers:
Code Readability:
The term code readability is used to denote the grace of code’s readability which includes following facts:
Code Usability:
The main concept of code reusability is design once and use wherever and whenever required by just calling the function using its function name. It helps to save the programmers time where method designed once is not redesigned again and used several times wherever required.
Maintenance:
Each task is divided into subtasks or separate functions and these subtasks are easy to maintain and trace. When any bug occurs then it can be easily traced and debug on that separate subtask only rather the manipulating the function of the whole task. This is very useful as it is easy in it tracing and debugging the bugs.
Debugging is Easy:
As stated above the function as a whole is divided into subprograms and these subprograms perform specific tasks. In these specific subtasks if anything goes irrespective to the program and program goes wrong then we can easily trace that which subprogram is going out of its bounds and after finding the task we can easily debug it without even touching the other code.
Pseudo codes are simple texts representing logic of the program and it is easily understandable by the people does not belong to programming background. This is an efficient way to create basic logic used to solve the problem.
Following are the benefits of the Pseudo Code:
Flow charts are diagrammatic representation of a pseudo codes. They are widely used in software development. Basically flow charts are used to represent any process in any business. So it is an easy approach for overview of the approach that can be used to solve the problem.
Benefits:
Flow Chart
The data related to employee and invoice will be stored in plain text files as the assignment required and the each record will be in a single line, in which each value will be separated by semicolon.
The file name used to store information
Employee information file will have the following structure
The information will be stored in file in one record per line, and the values will be in separated by semicolon, following will be the format
{employee_ID};{employee_password};{employee_name};{employee_job_title};{employee_rate}
Invoice information file will have the following structure
The information will be stored in file in one record per line, and the values will be in separated by semicolon, following will be the format
{invoice_ID};{ invoice_month};{invoice_amount};{ invoice_is_accepted}
I have developed Basic Accounting System using Microsoft Visual Studio 2012. I have implemented the overall functionality of the application separated modules, which makes the debugging easy and increases the reuse of code and increased the readability of the code.
Procedure used to present menu for employer user
Employer_Login () It is used to present menu if the employer logged in. It displays task that can be performed by Employer. The Employer can do the following task
Register New Employee: Employee can create a new employee.
Confirm the monthly payment: The Employer can confirm the monthly payment of an Employee.
List all employee id and name: The Employee can see the list of all Employees.
Procedure used to present menu for employer user
Employee_Login () It is used to present menu if any employee logged in. It displays task that can be performed by Employee. The Employee can do the following task
Check Payment: Employee can check for the confirmation of its invoices.
Invoice Employer: Employee can create new invoice to Employer that the Employee will have to confirm.
Procedures that are used to retrieve and save data to text files
Get_Data (): It is used to get data from the files, it uses or calls other procedure to perform this task.
Put_Data (): It is used to put data into the files, it uses or calls other procedure to perform this task.
All the above specified programming skills are well learnt like arrays, file reading/writing, methods, getting user inputs and use I/O library.
Arrays are used to store similar type of data sequentially. This data can be accessed randomly by using its index. Index in array starts with 0 to n-1 where n is the number of objects array can store.
Methods or functions are used to divide the project into separate small parts which as a whole perform the task of the given project.
File I/O Input Output standard libraries are used to manipulate the data in the files. Here manipulating contains all the functions that can be performed on the file are performed using these libraries.
Detail and the approaches that are used to develop the application are described below:
It is a console based application in which inputs are been fed by using I/O methods of .net environment. The user should first login into the application to use it. Different-Different menus are given for different-different users to use this application.
There are two classes which are used from System.IO to retrieve and save data to/from the text file in the comma separated format. These files are StreamWriter and StreamReader. To increase reusability and readability of code separate modules are divided for each function. This approach makes debugging easy.
Following procedures are implemented in the application:
Employer_Login() : It prints list of task to the Employee and read choice form the user and calls other procedures to perform the task.
Employee_Login() : It prints the list of the task if the Employee logged in, it read choice from the user and calls other procedures to perform the task.
User_Login() : It reads the user credentials, validate them and returns a Boolean value representing success or failure of the login operation.
Print_Menu() : It is used to display the main menu of the application, which is the start screen where the application user have to choose his/her role that whether he/she is an employee or employer.
Testing is a very crucial phase which is very important in the process of any software development. In testing many test cases are checked to be working correctly i.e. on some input the output of the program should be correct according to the user requirements. In this the assigned application and the developed application should have no difference. If this condition satisfies then the developed program is very well developed as well as tested.
Steps of testing:
I have checked the developed application and it is well tested and all validations are working perfect to get input by user.
Post rectification of the above mentioned errors and some minor formatting issues, I did not find any errors in the application, and it is working well to fulfil the requirement specified to complete the assignment.
Below chart show the basic flow of the application, it can be used to know that how a user should use the application.
Application Control Flow
Application Starts
Read user role (Employee/Employer)
Read and validate username and password to login
If Employer gets logged in
If Employee gets logged in
Main Screen of the application
Employer Menu Screen
Accept employee invoice screen
List of employee screen
Employee screen
Check invoice payment screen
Create invoice screen
Following are the System Requirements For the application
The application is designed and developed with all care to fulfil the requirement, proper modules are developed to perform a task in the application.
System.IO.StreamReader and System.IO.StreamWriter classes are used to read and store information in the files. All application data is store in plain text file, one record per line and the values are separated by semicolon (;)
It is a console based menu driven application so no GUI will be available to application users and the all input and output can be done through console.
Details
Other Assignments
Related Solution
Other Solution