A C program to generate Telephone Bill for Consumer – IGNOU MCA Assignment 2015 – 16

By | September 2, 2015

MASTER OF COMPUTER APPLICATIONS

Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(I)/L-017/Assignment/15-16
Maximum Marks : 100
Weightage : 25%

 

Write an interactive program in C language to create an application program which generates the telephone bills. It stores various details of users Telephone Number, Name, Address, No. of calls, local or STD/ISD call. Compute the amount to be paid if the charges per local call is Rs. 2/- and for STD/ISD call is Rs. 5/-. It should have feature of searching the customer records using the telephone number. The application should be designed user-friendly.

Note: You must execute the program and submit the program logic, sample input and output along with the necessary documentation for this question. Assumptions can be made wherever necessary.

#include<stdio.h>
#include<dos.h>
struct consumer
{
int TEL_NO;
char NAME[10];
char ADDRESS[25];
int LOCAL;
int STD_ISD;
}USER[12]={
{25621,”GANESH”,”KACHPADA,MALAD W”,15,5},
{25622,”MAHESH”,”DOMNIC COLONY,MALAD W”,30,0},
{25623,”SURESH”,”SUNDER NAGAR MALAD W”,128,15},
{25624,”KALPESH”,”KACHPADA,MALAD W”,826,7},
{25625,”RAHUL”,”DOMNIC COLONY,MALAD W”,24,3},
{25626,”SUBBU”,”SUNDER NAGAR MALAD W”,475,0},
{25627,”RAKESH”,”BHADRAN NAGAR MALAD W”,97,7},
{25628,”ATUL”,”KACHPADA,MALAD W”,152,45},
{25629,”DHARMESH”,”SUNDER NAGAR MALAD W”,326,45},
{25630,”AJAY”,”BHADRAN NAGAR MALAD W”,216,12},
{25631,”ABDUL”,”DOMNIC COLONY,MALAD W”,127,1},
{25632,”RASHMI”,”KACHPADA,MALAD W”,95,5}
};
void main()
{

int TELNO;
void gen_bill(int);
clrscr();
printf(“ENTER TELEPHONE NO.(BTWN 25621 TO 25632) TO GENERATE BILL : “);
scanf(“%d”,&TELNO);
if(TELNO>25620 && TELNO<25633)
gen_bill(TELNO);
else
printf(“\nYOU HAVE ENTERED WRONG TEL NO. !!”);
getch();
}
void gen_bill(int TELNO)
{
struct date D;
float LOCAL_CH,STD_ISD_CH,SER_CH,T_CALLS,T_BILL,FIX_CH=750;
getdate(&D);
printf(“\n\n\t\t\t MUMBAI TELEPHONE NIGAM LIMITED.”);
printf(“\n\t\t\t\t**BILL SUMMARY**\n\n”);
LOCAL_CH=USER[TELNO-25621].LOCAL*2;
STD_ISD_CH=USER[TELNO-25621].STD_ISD*5;
T_CALLS=LOCAL_CH+STD_ISD_CH;
SER_CH=(FIX_CH+T_CALLS)/10;
T_BILL=FIX_CH+T_CALLS+SER_CH;
printf(“\tCONS.NAME : %s\t\t\tBILL GEN. DATE:%d/%d/%d “,USER[TELNO-25621].NAME,D.da_day,D.da_mon,D.da_year);
printf(“\n\n\tADDRESS : %s\t\tBILL MONTH : %d %d\n”,USER[TELNO-25621].ADDRESS,D.da_mon-1,D.da_year);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\tNO. OF CALLS\t\t\t\tCHARGES\t\tAMOUNT(RS.)”);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\tLOCAL :\t%d\t\t\tMONTHLY(FIXED) :\t%.0f”,USER[TELNO-25621].LOCAL,FIX_CH);
printf(“\n\n\tSTD/ISD :\t%d\t\t\tCALL USAGE :\t%.0f”,USER[TELNO-25621].STD_ISD,T_CALLS);
printf(“\n\n\t\t\t\t\t\tSERVICE TAX\t\t%.0f”,SER_CH);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\t\t\t\t\t\tPAYABLE AMT\t\t%.0f”,T_BILL);
printf(“\n\t______________________________________________________________________”);

}

 

Code: –

[codesyntax lang=”c” lines=”normal”]

#include<stdio.h>
#include<dos.h>
struct consumer
{
int TEL_NO;
char NAME[10];
char ADDRESS[25];
int LOCAL;
int STD_ISD;
}USER[12]={
{25621,”GANESH”,”KACHPADA,MALAD W”,15,5},
{25622,”MAHESH”,”DOMNIC COLONY,MALAD W”,30,0},
{25623,”SURESH”,”SUNDER NAGAR MALAD W”,128,15},
{25624,”KALPESH”,”KACHPADA,MALAD W”,826,7},
{25625,”RAHUL”,”DOMNIC COLONY,MALAD W”,24,3},
{25626,”SUBBU”,”SUNDER NAGAR MALAD W”,475,0},
{25627,”RAKESH”,”BHADRAN NAGAR MALAD W”,97,7},
{25628,”ATUL”,”KACHPADA,MALAD W”,152,45},
{25629,”DHARMESH”,”SUNDER NAGAR MALAD W”,326,45},
{25630,”AJAY”,”BHADRAN NAGAR MALAD W”,216,12},
{25631,”ABDUL”,”DOMNIC COLONY,MALAD W”,127,1},
{25632,”RASHMI”,”KACHPADA,MALAD W”,95,5}
};
void main()
{

int TELNO;
void gen_bill(int);
clrscr();
printf(“ENTER TELEPHONE NO.(BTWN 25621 TO 25632) TO GENERATE BILL : “);
scanf(“%d”,&TELNO);
if(TELNO>25620 && TELNO<25633)
gen_bill(TELNO);
else
printf(“\nYOU HAVE ENTERED WRONG TEL NO. !!”);
getch();
}
void gen_bill(int TELNO)
{
struct date D;
float LOCAL_CH,STD_ISD_CH,SER_CH,T_CALLS,T_BILL,FIX_CH=750;
getdate(&D);
printf(“\n\n\t\t\t MUMBAI TELEPHONE NIGAM LIMITED.”);
printf(“\n\t\t\t\t**BILL SUMMARY**\n\n”);
LOCAL_CH=USER[TELNO-25621].LOCAL*2;
STD_ISD_CH=USER[TELNO-25621].STD_ISD*5;
T_CALLS=LOCAL_CH+STD_ISD_CH;
SER_CH=(FIX_CH+T_CALLS)/10;
T_BILL=FIX_CH+T_CALLS+SER_CH;
printf(“\tCONS.NAME : %s\t\t\tBILL GEN. DATE:%d/%d/%d “,USER[TELNO-25621].NAME,D.da_day,D.da_mon,D.da_year);
printf(“\n\n\tADDRESS : %s\t\tBILL MONTH : %d %d\n”,USER[TELNO-25621].ADDRESS,D.da_mon-1,D.da_year);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\tNO. OF CALLS\t\t\t\tCHARGES\t\tAMOUNT(RS.)”);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\tLOCAL :\t%d\t\t\tMONTHLY(FIXED) :\t%.0f”,USER[TELNO-25621].LOCAL,FIX_CH);
printf(“\n\n\tSTD/ISD :\t%d\t\t\tCALL USAGE :\t%.0f”,USER[TELNO-25621].STD_ISD,T_CALLS);
printf(“\n\n\t\t\t\t\t\tSERVICE TAX\t\t%.0f”,SER_CH);
printf(“\n\t______________________________________________________________________”);
printf(“\n\n\t\t\t\t\t\tPAYABLE AMT\t\t%.0f”,T_BILL);
printf(“\n\t______________________________________________________________________”);

}

[/codesyntax]

SCREEN SHOTS :-

C_program_Telephone_bill

C_program_Telephone_bill_Output