GEETHANJALI COLEGE OF ENGINEERING AND TECHNOLOGY
Mobile Bill
generation system
PROGRAMMING FOR PROBLEM SOLVING
DEPARTMENT OF FRESHMAN ENGINEERING
PRESENTING BY :
❖ Agasthya A (24R11A05FW)
❖ Ahmed Siddique (24R11A05HC)
❖ Charan Sai Y (24R11A05HU)
INTRODUCTION
A mobile bill generation system is a
computerised software application used
by mobile service providers to
automatically calculate and generate
detailed invoices for customers based
on their phone usage, including calls,
text, data consumption, and other
services, effectively detailing the
amount owned for a billing cycle and
delivering it to customer via various
channels like email or online portal;
essentially, it automates the process of
creating and sending mobile phone bills.
ABSTRACT
This code represents a basic mobile billing system designed to manage customer information, calculate bills, and ensure
that there are no duplicate customers in the system. The system can handle up to 100 customers, each of whom has a
unique ID, name, phone number, call minutes, and bill amount.
When the program starts, users are presented with a menu offering several options: add a new customer, view all
customers, calculate a specific customer’s bill, or exit the program. If the user selects "Add Customer, " the system
prompts for the customer's ID, name, phone number, and the number of call minutes. Before adding a new customer, the
system checks if the customer already exists by verifying the ID, name, and phone number. If any of these are found to be
duplicates, it notifies the user and prevents the customer from being added.
If the customer is new, their details are stored, and a bill is calculated based on a rate of RS1.50 per minute of calls. The
customer is then added to the list, and the total number of customers is updated.
The program also allows users to view a list of all customers along with their ID, name, phone number, call minutes, and
calculated bill amount. Additionally, users can select an option to calculate and display the bill for a specific customer by
entering their customer ID.
The program keeps running in a loop until the user chooses to exit. This system helps manage customer data, calculate
their charges, and prevents errors like duplicate customer entries.
SRS-SYSTEM REQUIREMENT SPECIFICATION
❖ HARDWARE REQUIREMENTS
1) RAM1GB
2) Harddisk 80GB
3) Processor Pentium
❖ SOFTWARE REQUIREMENTS
1) Operating System: Windows XP
2) Turbo C IDE
CODE
#include <stdio.h>
// Maximum customers
int MAX
CUSTOMERS = 100;
_
// Global variables
int customerCount = 0;
int customerID[100];
char name[100][50];
char phoneNumber[100][15];
int callMinutes[100];
float billAmount[100];
// Function to check if a customer already exists
int isDuplicate(int id, char customerName[], char phone[])
{
for (int i = 0; i < customerCount; i++)
{
if (customerID[i] == id)
{
printf("Error: Customer with ID %d already exists.\n"
, id);
return 1;
}
int j = 0;
while (name[i][j] != '\0' && customerName[j] != '\0' && name[i][j] == customerName[j])
{
j++;
}
if (name[i][j] == '\0' && customerName[j] == '\0')
{
printf("Error: Customer with name '%s' already exists.\n"
, customerName);
return 1;
}
j = 0;
{
while (phoneNumber[i][j] != '\0' && phone[j] != '\0' && phoneNumber[i][j] == phone[j])
j++;
}
if (phoneNumber[i][j] == '\0' && phone[j] == '\0')
{
printf("Error: Customer with phone number '%s' already exists.\n"
, phone);
return 1;
}
CODE
}
return 0;
}
// Function to add a customer
int addCustomer()
{
if (customerCount >= MAX
_
CUSTOMERS)
{
printf("Customer limit reached! Cannot add more customers.\n");
return 0;
}
int id;
char customerName[50], phone[15];
int minutes;
printf("Enter Customer ID: ");
scanf("%d"
, &id);
printf("Enter Customer Name: ");
scanf(" %[^\n]s"
, customerName);
printf("Enter Phone Number: ");
scanf("%s"
, phone);
printf("Enter Call Minutes: ");
scanf("%d"
, &minutes);
// Check for duplicates
if (isDuplicate(id, customerName, phone))
{
return 0; // Do not add duplicate
}
// Add customer details
customerID[customerCount] = id;
int i = 0;
while (customerName[i] != '\0')
{
name[customerCount][i] = customerName[i];
i++;
}
name[customerCount][i] = '\0'; // Null terminate the string
i = 0;
while (phone[i] != '\0')
{
CODE
phoneNumber[customerCount][i] = phone[i];
i++;
}
phoneNumber[customerCount][i] = '\0'; // Null terminate the string
callMinutes[customerCount] = minutes;
// Calculate bill amount
float ratePerMinute = 1.50; // Example rate: rs.1.50 per minute
billAmount[customerCount] = callMinutes[customerCount] * ratePerMinute;
customerCount++;
printf("Customer added successfully!\n");
return 0;
}
// Function to view all customers
int viewCustomers()
{
if (customerCount == 0)
{
printf("No customers to display.\n");
return 0;
}
printf("\nCustomer List:\n");
printf("ID\tName\t\tPhone\t\tCall Minutes\tBill Amount\n");
printf("
-------------------------------------------------------------\n");
for (int i = 0; i < customerCount; i++)
{
printf("%d\t%s\t\t%s\t\t%d\t\trs.%.2f\n"
,
customerID[i],
name[i],
phoneNumber[i],
callMinutes[i],
billAmount[i]);
}
return 0;
}
// Function to calculate the bill for a specific customer
int calculateBill()
{
int id, found = 0;
printf("Enter Customer ID to calculate bill: ");
scanf("%d"
, &id);
for (int i = 0; i < customerCount; i++)
{
if (customerID[i] == id)
{
CODE
printf("Customer: %s\n"
, name[i]);
printf("Phone: %s\n"
, phoneNumber[i]);
printf("Call Minutes: %d\n"
, callMinutes[i]);
printf("Bill Amount: rs.%.2f\n"
, billAmount[i]);
found = 1;
break;
}
}
if (!found)
{
}
return 0;
printf("Customer with ID %d not found.\n"
, id);
}
// Main function
int main()
{
int choice;
do
{
printf("\n*** Mobile Billing System ***\n");
printf("1. Add Customer\n");
printf("2. View All Customers\n");
printf("3. Calculate Bill for a Customer\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d"
, &choice);
if (choice == 1)
{
addCustomer();
}
else if (choice == 2)
{
viewCustomers();
}
else if (choice == 3)
{
calculateBill();
}
else if (choice == 4)
{
CODE
printf("Exiting the system. Thank you!\n");
}
else
{
printf("Invalid choice! Please try again.\n");
}
} while (choice != 4);
return 0;
}
TEST CASE - 1
TEST CASE - 2
TEST CASE - 3
KEY BENEFITS & CONCLUSION
❖ Reduced human involvement
❖ Automated calculations and validation
❖ Group-wise remote access
❖ More detailed reports
❖ Improved system security
❖ Proposed system is expected to fulfil client requirements
THANK YOU.