Visual C++ Program for the Implementation of Petrol Vending Machine System | IT1253 - Software Engineering Laboratory


ABSTRACT:
This project implements the process of petrol vending. It’s an application of getting petrol from the agency. Here the records of the customer are maintained. The current system makes use of notebooks or ledgers to maintain the details. All the records are entered and accessed manually. While maintaining the details in ledgers it becomes very difficult to view the records. Moreover it is very much essential to be aware of all records. Now in this application MS ACCESS & C are used to store & retrieve the records. Information recorded automatically updated into the database accordingly to the data needs. The objectives of the proposed system are to have a detailed review of the customers at present. The input to the application is the details of the customers based on the booking details. The output is the details that are collected from the application and are given out under specific conditions.


REQUIREMENT ANALYSIS:

SOFTWARE REQUIREMENTS:
    Front End   :    ‘C++’ language.
    Back End   :     File Management System (using Dat files)
    Operating system:    Any Operating System (Window or Linux)

HARDWARE REQUIREMENTS:
    Processor     :     3.06 GHZ operating speed.
    Hard Disk    :      80GB Capacity.
    RAM           :       256MB
    Monitor       :       CRT 17’
    Mouse         :       OPTICAL
    Keyboard    :       Alphanumeric keys.
     The specified hardware requirements are the minimum requirements that are needed to implement in the project.

FUNCTIONAL REQUIREMENTS:
    As mentioned in the requirements, the Petrol Vending system involves the following function or process
Petrol Vending system consists of four modules. They are
    Module 1: Insert Module
    Module 2: Delete Module
    Module 3: Display Module
    Module 4: Exit
Insert Module:
In this module the user enters the detail of the petrol bill.
Delete Module:
In this module the user deletes the detail of the petrol bill.
Display Module:
This module display the detail of the petrol bill.
Exit:
    In this module the user can quit from the project.

NON FUNCTIONAL REQUIREMENT:

    It is reliable software. Whenever the user wants to retrieve any information from the database, it returns with the correct information. Provided, the information stored is a correct one. The cost of maintenance of the software is very low. The size of the software is less. This means, it is a portable one. If any request is given, the time taken for the response is low. This makes the software more efficient.

Goal of implementation:
The primary goal of this application is to vend the petrol n calculating the amount for it. This is achieved by the above mentioned requirements.

DESIGN:
Software design deals with transforming the customer requirements, as described in the SRS document, into a form (a set of documents) that is suitable for implementation in a programming language. A good software design is seldom arrived by using a single step procedure but rather through several iterations through a series of steps. Design activities can be broadly classified into two important parts: 
• Preliminary (or high-level) design and
          • Detailed design. 
The aim of design is to produce a model that will provide a seamless transition to the coding phase, i.e. once the requirements are analyzed and found to be satisfactory, a design model is created which can be easily implemented.

Characteristics of a good software design
The characteristics are listed below: 

• Correctness: our application has got a perfect design that which correctly implement all the functionalities identified in the SRS document. 
• Understandability: our application is easily understandable.
• Efficiency: our application is highly efficient. 
• Maintainability: It is easily amenable to change. 

Data Flow Diagram (Level 0):

Component Description: 



Entity Relationship  Diagram:


 Component Description:

 


TESTING:
Testing a program consists of providing the program with a set of test inputs (or test cases) and observing if the program behaves as expected. If the program fails to behave as expected, then the conditions under which failure occurs are noted for later debugging and correction.

Unit testing:
Unit testing is undertaken after a module has been coded and successfully reviewed. Unit testing (or module testing) is the testing of different units (or modules) of a system in isolation.
Besides the module under test itself, the following steps are needed in order to be able to test the module: 
• The procedures belonging to other modules that the module under test calls. 
• Nonlocal data structures that the module accesses. 
• A procedure to call the functions of the module under test with appropriate parameter.

System testing:
System tests are designed to validate a fully developed system to assure that it meets its requirements. 
 There are essentially three main kinds of system testing: 
• Alpha Testing. Alpha testing refers to the system testing carried out by the test team within the developing organization. 
• Beta testing. Beta testing is the system testing performed by a select group of friendly customers. 
• Acceptance Testing. Acceptance testing is the system testing performed by the customer to determine whether he should accept the delivery of the system.

SOURCE CODE:
#include<windows.h>                 
#include<sqlext.h>
#include<stdio.h>
#include<string.h>
#define TEST_LEN 50
int main()
{
int c,Amt=50;
    char ch='y';
    SQLINTEGER Litres,Amount;
    SQLCHAR Customername[TEST_LEN+1];
    HENV hEnv=NULL;
    HDBC hDBC=NULL;
    HSTMT hStmt=NULL;
    UCHAR szSqlStr[]="insert into pet(Customername,Litres,Amount) values(?,?,?)";
    UCHAR szSqlStr1[]="delete * from pet where Customername = ?";
    UCHAR szSqlStr2[]="select * from pet";
    UCHAR szDSN[SQL_MAX_DSN_LENGTH]="petrol";
    UCHAR *szUID=NULL;
    UCHAR *szPasswd=NULL;
    UCHAR szModel1[128];
    UCHAR szModel2[128];
    UCHAR szModel3[128];
    SDWORD cbModel1;
    SDWORD cbModel2;
    SDWORD cbModel3;
    SDWORD cbtest=SQL_NTS;
    RETCODE retcode;
    do
    {
    printf("=======================================");
    printf("\n   PETROL VENDING SYSTEM");
    printf("\n=======================================\n");
    printf("1.Enter the bill detail \n2.Delete the bill detail\n3.Display the bill detail\n\n");
    printf("Enter ur option......\n");
    scanf("%d",&c);
    switch(c)
    {
    case 1:
        printf("\n-----------------------------------------");
        printf("\nEnter the details");
        printf("\n-----------------------------------------");
        printf("\nEnter the Customername:\t");
        scanf("%s",&Customername);
        printf("\nAmount per Litre:\t%d",Amt);
        printf("\nEnter Litres:\t");
        scanf("%d",&Litres);
        Amount=Litres*Amt;
        printf("\n-----------------------------------------");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr,sizeof(szSqlStr));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,Customername,0,&cbtest);
SQLBindParameter(hStmt,2,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Litres,0,&Litres);
SQLBindParameter(hStmt,3,SQL_PARAM_INPUT,SQL_C_LONG,SQL_INTEGER,1,0,&Amount,0,&Amount);
            retcode=SQLExecute(hStmt);
            printf("\n\n Detail is inserted.......... \n\n");
        }
        break;
    case 2:
        printf("\nDelete the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
        retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,
            SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr1,sizeof(szSqlStr1));
SQLBindParameter(hStmt,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,TEST_LEN,0,Customername,0,&cbtest);
            printf("\nEnter the Customer Name\n");
            scanf("%s",&Customername);
            retcode=SQLExecute(hStmt);
            printf("detail has been deleted\n\n");
        }
        break;
    case 3:
        printf("\nDisplay the detail\n");
        SQLAllocEnv(&hEnv);
        SQLAllocConnect(hEnv,&hDBC);
    retcode=SQLConnect(hDBC,szDSN,SQL_NTS,szUID,SQL_NTS,szPasswd,SQL_NTS);
        if(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
        {
            retcode=SQLAllocStmt(hDBC,&hStmt);
            retcode=SQLPrepare(hStmt,szSqlStr2,sizeof(szSqlStr2));
            retcode=SQLExecute(hStmt);
            SQLBindCol(hStmt,1,SQL_C_CHAR,szModel1,sizeof(szModel1),&cbModel1);
            SQLBindCol(hStmt,2,SQL_C_CHAR,szModel2,sizeof(szModel2),&cbModel2);
            SQLBindCol(hStmt,3,SQL_C_CHAR,szModel3,sizeof(szModel3),&cbModel3);
            retcode=SQLFetch(hStmt);
            printf("\n\tCustomername\tLitres\tAmount\n\n");
            while(retcode==SQL_SUCCESS||retcode==SQL_SUCCESS_WITH_INFO)
            {
               printf("\t%s\t\t%s\t%s\n",szModel1,szModel2,szModel3);
               retcode=SQLFetch(hStmt);
               }
        }
        break;
             }
flushall();
printf("\nDo u wan to cont (y/n)");
scanf("%s",&ch);
}
while(ch=='y');
return 0;
}

OUTPUT:

INSERTION OF BILL DETAIL:

DISPLAY:

DELETION OF BILL DETAIL:

DISPLAY:

CONCLUSION:
         Thus our application- petrol vending machine system is successfully automated with the mentioned software and hardware requirements. The records that are entered in are automatically updated in the database with the ODBC driver. The above mentioned testing techniques are also performed and our application is finally deployed to our customers. This  has the advantage of maintaining the records properly without any manual stress. Hence it becomes easier to view the details later. The maintenance of our system wholly depends on the customer’s risk.
Previous
Next Post »

Still not found what you are looking for? Try again here.