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: -

  1. #include<stdio.h>
  2. #include<dos.h>
  3. struct consumer
  4. {
  5. int TEL_NO;
  6. char NAME[10];
  7. char ADDRESS[25];
  8. int LOCAL;
  9. int STD_ISD;
  10. }USER[12]={
  11. {25621,"GANESH","KACHPADA,MALAD W",15,5},
  12. {25622,"MAHESH","DOMNIC COLONY,MALAD W",30,0},
  13. {25623,"SURESH","SUNDER NAGAR MALAD W",128,15},
  14. {25624,"KALPESH","KACHPADA,MALAD W",826,7},
  15. {25625,"RAHUL","DOMNIC COLONY,MALAD W",24,3},
  16. {25626,"SUBBU","SUNDER NAGAR MALAD W",475,0},
  17. {25627,"RAKESH","BHADRAN NAGAR MALAD W",97,7},
  18. {25628,"ATUL","KACHPADA,MALAD W",152,45},
  19. {25629,"DHARMESH","SUNDER NAGAR MALAD W",326,45},
  20. {25630,"AJAY","BHADRAN NAGAR MALAD W",216,12},
  21. {25631,"ABDUL","DOMNIC COLONY,MALAD W",127,1},
  22. {25632,"RASHMI","KACHPADA,MALAD W",95,5}
  23. };
  24. void main()
  25. {
  26. int TELNO;
  27. void gen_bill(int);
  28. clrscr();
  29. printf("ENTER TELEPHONE NO.(BTWN 25621 TO 25632) TO GENERATE BILL : ");
  30. scanf("%d",&TELNO);
  31. if(TELNO>25620 && TELNO<25633)
  32. gen_bill(TELNO);
  33. else
  34. printf("\nYOU HAVE ENTERED WRONG TEL NO. !!");
  35. getch();
  36. }
  37. void gen_bill(int TELNO)
  38. {
  39. struct date D;
  40. float LOCAL_CH,STD_ISD_CH,SER_CH,T_CALLS,T_BILL,FIX_CH=750;
  41. getdate(&D);
  42. printf("\n\n\t\t\t MUMBAI TELEPHONE NIGAM LIMITED.");
  43. printf("\n\t\t\t\t**BILL SUMMARY**\n\n");
  44. LOCAL_CH=USER[TELNO-25621].LOCAL*2;
  45. STD_ISD_CH=USER[TELNO-25621].STD_ISD*5;
  46. T_CALLS=LOCAL_CH+STD_ISD_CH;
  47. SER_CH=(FIX_CH+T_CALLS)/10;
  48. T_BILL=FIX_CH+T_CALLS+SER_CH;
  49. 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);
  50. printf("\n\n\tADDRESS : %s\t\tBILL MONTH : %d %d\n",USER[TELNO-25621].ADDRESS,D.da_mon-1,D.da_year);
  51. printf("\n\t______________________________________________________________________");
  52. printf("\n\n\tNO. OF CALLS\t\t\t\tCHARGES\t\tAMOUNT(RS.)");
  53. printf("\n\t______________________________________________________________________");
  54. printf("\n\n\tLOCAL :\t%d\t\t\tMONTHLY(FIXED) :\t%.0f",USER[TELNO-25621].LOCAL,FIX_CH);
  55. printf("\n\n\tSTD/ISD :\t%d\t\t\tCALL USAGE :\t%.0f",USER[TELNO-25621].STD_ISD,T_CALLS);
  56. printf("\n\n\t\t\t\t\t\tSERVICE TAX\t\t%.0f",SER_CH);
  57. printf("\n\t______________________________________________________________________");
  58. printf("\n\n\t\t\t\t\t\tPAYABLE AMT\t\t%.0f",T_BILL);
  59. printf("\n\t______________________________________________________________________");
  60. }

SCREEN SHOTS :-

C_program_Telephone_bill

C_program_Telephone_bill_Output