Responsive image
Responsive image

A  PROJECT WORK  IN QBASIC


ON
“TELEPHONE BILLING SYSTEM”
Submitted By:                              Roll No.
……….         .……..
……….         ………..

Submitted To:
……………..
Computer Department

PREFACE

As per the requirements of S.L.C., this project work is done in QBASIC under the guidance of our computer teacher Mr. ………... This project work was a great experience for us. We learnt a lot from this project. This project has been a platform for us to learn new things as well as put together all the things we have learnt  in QBASIC in an organized manner to generate a meaningful program. Thus, this project work has helped a lot to improve our knowledge of QBASIC.
This project is based on menu-driven program about telephone bill system. It has facilities to add records, view records, search records by name and phone number and delete records and view telephone bill.
We would like to thank Mr. ………… for guiding us in completing the project.

Name of student
………………
………………

CONTENTS

  • PREFACE
  • BACKGROUND OF THE PROJECT
  • AIMS AND OBJECTIVES
  • STRUCTURE OF THE PROGRAM
  • ALGORITHMS
  • Algorithm for Main Menu
    Algorithm for Creating data file
    Algorithms for Viewing records
    Algorithms for Appending records
    Algorithms for Searching records by name
    Algorithms for Searching records by phone number
    Algorithms for deleting records
    Algorithms for Viewing telephone bill
  • FLOWCHARTS
  • Flowchart for Main Menu
    Flowchart for Creating data file
    Flowchart for Viewing records
    Flowchart for Appending records
    Flowchart for Searching records by name
    Flowchart for Searching records by phone number
    Flowchart for deleting records
    Flowchart for Viewing telephone bill
  • PROGARM CODING
  • OUTPUT SCREENS

BACKGROUND OF THE PROJECT

A data file has a collection of related data. It can be created in QBASIC to store data input by the user. This project is designed to fulfill all requirements of SLC project work. This project titled “Telephone Bill System” has a data file that store customer id, customer name, telephone number, alternative telephone number, line type, company branch and number of calls made in a particular month. This project is based on menu-driven program and has facilities to add records, view records, search records by name and phone number and delete records and view telephone bill.

AIMS AND OBJECTIVES

  • To provide concept of modular programming
  • To handle large database properly
  • To reduce manual errors
  • To search information conveniently
  • To decrease the load on manpower

PROGRAM ALGORITHMS

  • Algorithm for Main Menu
  • Step 1: Start
    Step 2: Declare required variables and procedure
    Step 3: Display Main Menu having options
  • Create data file
  • View records
  • Append records
  • Search records by Name
  • Search records by Phone Number
  • Delete records
  • View telephone bill
  • Exit

Step 4: Stop

Algorithm for Adding Records

Step 1: Start
Step 2: Declare variables
Step 3: Create a data file named”telecell.txt” in OUTPUT mode
Step 4: Get id% (telephone subscriber id), nam$ (name of
subscriber), tel$(telephone number), alt$(alternative telephone number), type$(line type), branch$(company branch) and c%(number of calls made in a particular month)
Step 5: Store all the values of the variables in the data file
Step 6: Does the user want to enter more records
{Yes: Repeat step 3, 4 and 5}
Step 7: Stop

Algorithms for Viewing records

Step 1: Start
Step 2: Declare variables
Step 3: Open “telecell.txt” in INPUT mode
Step 4: Retrieve data from the file and store them in id%, nam$, tel$, alt$, type$,  branch$, c%
Step 5: Display the data
Step 6: Are all the records retrieved?
{No: repeat step 4 and 5}
Step 7: Stop

Algorithms for Appending  records

Step 1: Start
Step 2: Declare variables
Step 3: Create a data file named”telecell.txt” in APPEND mode
Step 4: Get id% (telephone subscriber id), nam$ (name of
subscriber), tel$(telephone number), alt$(alternative telephone number), type$(line type), branch$(company branch) and c%(number of calls made in a particular month)
Step 5: Store all the values of the variables in the datafile
Step 6: Does the user want to enter more records
{Yes: Repeat step 3, 4 and 5}
Step 7: Stop

Algorithms for Searching records by name

Step1: Start
Step2: Declare variable
Step 3: Open “telecell.txt” in INPUT mode
Step 4: Read n$
Step 5: Read id%, nam$, tel$, alt$, type$, branch$,c%
Step 6: Is n$=nam$
{Yes: Display id%, nam$, tel$, alt$, type$, branch$, c%}
Step 7:Are all records retrieved?
{No: Goto step 5}
Step 8: Is the record found?
{No:Display message as record not found
Step 9: Stop

Algorithms for Searching records by  phone number

Step1: Start
Step2: Declare variables
Step 3: Open “telecell.txt” in INPUT mode
Step 4: Read ph$
Step 5: Read id%, nam$, tel$, alt$, type$, branch$
Step 6: Is ph$=tel$
{Yes: Display id%, nam$, tel$, alt$, type$, branch$}
Step 7: Are all records retrieved?
{No: Goto step 5}
Step 8: Is the record found?
{No: Display message as record not found}
Step 9: Stop

Algorithms for deleting records

Step1: Start
Step2: Declare variables
Step 3: Open “telecell.txt” in INPUT mode
Step 4: Create “tele2.txt” in APPEND mode
Step 5:Read n$
Step 6: Read id%, nam$, tel$, alt$, type$, branch$
Step 7:Is n$=nam$
{No: Store id%, nam$, tel$, alt$, type$, branch$
in “tele2.txt”}
Step 8: Are all records retrieved?
{No: Goto step 6}
Step 9: Delete “telecell.txt”
Step 10: Name “tele1.txt” as “telecell.txt’
Step 11: Is the record found?
{No: Display message as record not found}
Step 12: Stop

Algorithms for Viewing telephone bill

Step 1: Start
Step 2: Read n$
Step 3: Is n$=nam$?
{Yes: Display bill}
{No: Display message as record not found}
Step 4: Stop

 

FLOWCHARTS

Flowchart for main menu

Flowchart for Creating data file

Flowchart for Viewing Records

Flowchart for Appending Records

Flowchart for searching records by name

Flowchart for searching records by phone number

Flowchart for deleting records

Flowchart to view telephone bill

PROGRAM CODING

 

DECLARE SUB add ()
DECLARE SUB display ()
DECLARE SUB appendr ()
DECLARE SUB searchn ()
DECLARE SUB searchp ()
DECLARE SUB delete ()
DECLARE SUB bill ()
DECLARE SUB E ()

top:
CLS
PRINT TAB(35); "WELCOME"
PRINT TAB(25); "PROGRAM TO CALCULATE TELEPHONE BILL"
PRINT "****************************************************************************"
PRINT TAB(35); "MAIN MENU"
PRINT "****************************************************************************"
PRINT TAB(30); "1.Create data file"
PRINT TAB(30); "2.View Records"
PRINT TAB(30); "3.Append Records"
PRINT TAB(30); "4.Search Records by name"
PRINT TAB(30); "5.Search Records by phone number"
PRINT TAB(30); "6.Delete Records"
PRINT TAB(30); "7.View telephone bill"
PRINT TAB(30); "8.Exit "
PRINT "****************************************************************************"
INPUT " Select your option (1/2/3/4/5/6/7/8)"; s
SELECT CASE s
              CASE 1
                            CALL add
                            GOTO top
              CASE 2
                            CALL display
                            GOTO top
              CASE 3
                            CALL appendr
                            GOTO top
              CASE 4
                            CALL searchn
                            GOTO top
              CASE 5
                            CALL searchp
                            GOTO top
              CASE 6
                             CALL delete
                            GOTO top
              CASE 7
                            CALL bill
                            GOTO top
              CASE 8
                            CALL E
              CASE ELSE
BEEP
PRINT "INVALID CHIOCE"
INPUT "PRESS ANY KEY TO CONTINUE"; l$
              GOTO top
END SELECT
PRINT "THANK YOU FOR USING THE PROGRAM"
END

 

SUB add
CLS
PRINT "CREATE YOUR DATA FILE NOW"
OPEN "telecell.txt" FOR OUTPUT AS #1
DO
              INPUT "Enter id "; id%
              INPUT "Enter name of customer"; nam$
              INPUT "Enter telephone number"; tel$
              INPUT "Enter alternative telephone number"; alt$
              INPUT "Enter line type(Local/STD/ISTD)"; type$
              INPUT "Enter company branch"; branch$
              INPUT "Enter total number of calls"; c%
              WRITE #1, id%, nam$, tel$, alt$, type$, branch$, c%
              INPUT "Want to add more records(Y/N)"; ans$
              ans$ = UCASE$(ans$)
LOOP WHILE ans$ = "Y"
CLOSE #1
INPUT "PRESS ANY KEY TO CONTINUE"; l$
END SUB

 

SUB appendr
CLS
PRINT "ADD MORE RECORDS NOW"
OPEN "telecell.txt" FOR APPEND AS #3
DO
              INPUT "Enter id "; id%
              INPUT "Enter name of customer"; nam$
              INPUT "Enter telephone number"; tel$
              INPUT "Enter alternative telephone number"; alt$
              INPUT "Enter line type(Local/STD/ISTD)"; type$
              INPUT "Enter company branch"; branch$
              INPUT "Enter number of calls"; c%
              WRITE #3, id%, nam$, tel$, alt$, type$, branch$, c%
              INPUT "Want to add more records(Y/N)"; ans$
               ans$ = UCASE$(ans$)
LOOP WHILE ans$ = "Y"
CLOSE #3
INPUT "PRESS ANY KEY TO CONTINUE"; l$
END SUB

 

SUB bill
CLS
PRINT "VIEWING TELEPHONE BILL NOW"
menu:
OPEN "telecell.txt" FOR INPUT AS #7
INPUT "Enter name of the person whose bill you want to view"; n$
dat$ = LEFT$(DATE$, 2)
IF dat$ = "1" THEN
               m$ = "January"
ELSEIF dat$ = "2" THEN
              m$ = "February"
ELSEIF dat$ = "3" THEN
              m$ = "March"
ELSEIF dat$ = "4" THEN
               m$ = "April"
ELSEIF dat$ = "5" THEN
               m$ = "May"
ELSEIF dat$ = "6" THEN
               m$ = "June"
ELSEIF dat$ = "7" THEN
               m$ = "July"
ELSEIF dat$ = "8" THEN
               m$ = "August"
ELSEIF dat$ = "9" THEN
               m$ = "September"
ELSEIF dat$ = "10" THEN
               m$ = "October"
ELSEIF dat$ = "11" THEN
               m$ = "November"
ELSEIF dat$ = "12" THEN
               m$ = "December"
END IF
DO WHILE NOT EOF(7)
f = 0
INPUT #7, id%, nam$, tel$, alt$, type$, branch$, c%
IF UCASE$(n$) = UCASE$(nam$) THEN
PRINT TAB(30); "TELEPHONE BILL"
PRINT "****************************************************************************"
PRINT "CUSTOMER ID="; id%
PRINT "CUSTOMER NAME="; nam$
PRINT "TELEPHONE NUMBER="; tel$
PRINT "ALTERNATIVE TELEPHONE; NUMBER = "; alt$
PRINT "LINE TYPE="; type$
PRINT "COMPANY BRANCH="; branch$
PRINT "NUMBER OF CALL MADE IN"; m$; "="; c%
PRINT "****************************************************************************"
type$ = UCASE$(type$)
IF type$ = "LOCAL" THEN
              t = c% * 2
ELSEIF type$ = "STD" THEN
              t = c% * 3
ELSE
              t = c% * 5
END IF
PRINT "TOTAL= Rs."; t
EXIT DO
ELSE
              f = 1
END IF
LOOP
CLOSE #7
IF f = 1 THEN PRINT "no record found"
INPUT "do u wanna check another? (y/n)"; zz$
IF UCASE$(zz$) = "Y" THEN
              GOTO menu
ELSE
              INPUT "PRESS ANY KEY TO CONTINUE"; l$
END IF
END SUB

 

SUB delete
CLS
PRINT "DELETE REQUIRED RECORDS NOW "
ans$ = "y"
WHILE LCASE$(ans$) = "y"
OPEN "telecell.txt" FOR INPUT AS #6
OPEN "temp2.txt" FOR APPEND AS #7
INPUT "Enter name of the person whose records need to be deleted"; n$
DO WHILE NOT EOF(6)
              INPUT #6, id%, nam$, tel$, alt$, type$, branch$, c%
              IF UCASE$(n$) <> UCASE$(nam$) THEN
              WRITE #7, id%, nam$, tel$, alt$, type$, branch$, c%
              f = 1
ELSE
              f = 0
              EXIT DO
END IF
LOOP
CLOSE #6, #7
KILL "telecell.txt"
NAME "temp2.txt" AS "telecell.txt"
IF f <> 0 THEN
              PRINT "Name not found"
ELSE
              PRINT "Record is deleted"
END IF
INPUT "Do you want to delete more records (Y/N)"; ans$
WEND
INPUT "PRESS ANY KEY TO CONTINUE"; l$
END SUB

 

SUB display
CLS
OPEN "telecell.txt" FOR INPUT AS #2
dat$ = LEFT$(DATE$, 2)
IF dat$ = "1" THEN
              m$ = "January"
ELSEIF dat$ = "2" THEN
              m$ = "February"
ELSEIF dat$ = "3" THEN
              m$ = "March"
ELSEIF dat$ = "4" THEN
              m$ = "April"
ELSEIF dat$ = "5" THEN
              m$ = "May"
ELSEIF dat$ = "6" THEN
               m$ = "June"
ELSEIF dat$ = "7" THEN
              m$ = "July"
ELSEIF dat$ = "8" THEN
               m$ = "August"
ELSEIF dat$ = "9" THEN
               m$ = "September"
ELSEIF dat$ = "10" THEN
              m$ = "October"
ELSEIF dat$ = "11" THEN
              m$ = "November"
ELSEIF dat$ = "12" THEN
m$ = "December"
END IF
WHILE NOT EOF(2)
INPUT #2, id%, nam$, tel$, alt$, type$, branch$, c%
CLS
PRINT "VIEWING RECORDS NOW"
PRINT "CUSTOMER ID=", id%
PRINT "CUSTOMER NAME=", nam$
PRINT "TELEPHONE NUMBER=", tel$
PRINT "ALTERNATIVE TEEPHONE NUMBER=", alt$
PRINT "LINE TYPE=", type$
PRINT "COMPANY BRANCH=", branch$
PRINT "NUMBER OF CALL MADE IN "; m$; "="; c%

INPUT " PRESS ANY KEY TO CONTINUE"; l$
WEND
CLOSE #2

END SUB

 

SUB E
CLS
PRINT "EXITING THE PROGRAM"
PRINT "PROGRAM DEVELOPED BY:"
PRINT "…………………………………"
PRINT "CLASS :10"
PRINT "SCHOOL NAME"
END SUB

 

SUB searchn
CLS
ans$ = "Y"
WHILE ans$ = "Y"
OPEN "telecell.txt" FOR INPUT AS #4
INPUT "Enter the name you want to search"; n$
dat$ = LEFT$(DATE$, 2)
IF dat$ = "1" THEN
              m$ = "January"
ELSEIF dat$ = "2" THEN
              m$ = "February"
ELSEIF dat$ = "3" THEN
               m$ = "March"
ELSEIF dat$ = "4" THEN
              m$ = "April"
ELSEIF dat$ = "5" THEN
              m$ = "May"
ELSEIF dat$ = "6" THEN
              m$ = "June"
ELSEIF dat$ = "7" THEN
               m$ = "July"
ELSEIF dat$ = "8" THEN
               m$ = "August"
ELSEIF dat$ = "9" THEN
               m$ = "September"
ELSEIF dat$ = "10" THEN
               m$ = "October"
ELSEIF dat$ = "11" THEN
               m$ = "November"
ELSEIF dat$ = "12" THEN
              m$ = "December"
END IF
DO WHILE NOT EOF(4)
f = 0
INPUT #4, id%, nam$, tel$, alt$, type$, branch$, c%
IF UCASE$(n$) = UCASE$(nam$) THEN
PRINT "CUSTOMER ID="; id%
PRINT "CUSTOMER NAME="; nam$
PRINT "TELEPHONE NUMBER="; tel$
PRINT "ALTERNATIVE TEEPHONE NUMBER="; alt$
PRINT "LINE TYPE="; type$
PRINT "COMPANY BRANCH="; branch$
PRINT "NUMBER OF CALL MADE IN "; m$; "="; c%
EXIT DO
ELSE
              f = 1
END IF
LOOP
CLOSE #4
IF f = 1 THEN PRINT "NO RECORD FOUND"
              INPUT "Do you want to search more records(Y/N)"; ans$
              ans$ = UCASE$(ans$)
WEND
INPUT "PRESS ANY KEY TO CONTINUE"; l$
END SUB

 

SUB searchp
CLS
ans$ = "Y"
WHILE ans$ = "Y"
OPEN "telecell.txt" FOR INPUT AS #5
INPUT "Enter the phone number you want to search"; p$
dat$ = LEFT$(DATE$, 2)
IF dat$ = "1" THEN
               m$ = "January"
ELSEIF dat$ = "2" THEN
              m$ = "February"
ELSEIF dat$ = "3" THEN
              m$ = "March"
ELSEIF dat$ = "4" THEN
               m$ = "April"
ELSEIF dat$ = "5" THEN
              m$ = "May"
ELSEIF dat$ = "6" THEN
               m$ = "June"
ELSEIF dat$ = "7" THEN
              m$ = "July"
ELSEIF dat$ = "8" THEN
               m$ = "August"
ELSEIF dat$ = "9" THEN
              m$ = "September"
ELSEIF dat$ = "10" THEN
               m$ = "October"
ELSEIF dat$ = "11" THEN
               m$ = "November"
ELSEIF dat$ = "12" THEN
              m$ = "December"
END IF

        DO WHILE NOT EOF(5)
f = 0
INPUT #5, id%, nam$, tel$, alt$, type$, branch$, c%
IF tel$ = p$ OR alt$ = p$ THEN
PRINT "CUSTOMER ID="; id%
PRINT "CUSTOMER NAME="; nam$
PRINT "TELEPHONE NUMBER="; tel$
PRINT "ALTERNATIVE TEEPHONE NUMBER="; alt$
PRINT "LINE TYPE="; type$
PRINT "COMPANY BRANCH="; branch$
PRINT "NUMBER OF CALL MADE IN "; m$; "="; c%
EXIT DO
ELSE
              f = 1
END IF
LOOP
CLOSE #5
IF f = 1 THEN PRINT "NO RECORD FOUND"
INPUT "Do you want to search more records(Y/N)"; ans$
ans$ = UCASE$(ans$)
WEND
INPUT "PRESS ANY KEY TO CONTINUE"; l$
END SUB

OUTPUT SCREENS : Take Screen Shot and Paste in MS-Word



Post Your Comment Here