NATIONAL UNIVERSITY OF SCIENCES AND TECHNOLOGY
School of Electrical Engineering and Computer Sciences
PAKISTAN STUDIES (HU-107)
ASSIGNMENT# 1
Title of the assignment: ____________________________________________
SUBMITTED TO: Dr. Sobia Jamil
SUBMITTED BY: (Name + CMS ID)
CLASS + SECTION: ___________________
Date of Submission: ___________________
Banking Management System
Header Files:
1. #include <stdio.h>: Provides functionality for standard input/output
operations.
2. #include <stdlib.h>: Offers functions for memory allocation and general
utilities.
3. #include <string.h>: Contains functions for manipulating strings.
4. #include <time.h>: Includes functions for working with time.
Constants and Structures:
#define MAX_CUSTOMERS 100: Sets the maximum number of customers to
100.
#define MAX_NAME_LENGTH 50: Defines the maximum length of customer
names.
#define MAX_TRANSACTIONS 100: Specifies the maximum number of
transactions per customer.
#define MAX_ACCOUNT_NUMBER_LENGTH 20: Specifies the maximum
length of account numbers.
struct Transaction { ... }: Defines a structure to represent a transaction.
struct Customer { ... }: Defines a structure to represent a customer.
File Handling Functions:
void writeToFile(struct Customer* customers, int numCustomers, const char*
fileName) { ... }:
Writes customer data to a file, including account information and transactions.
int readFromFile(struct Customer* customers, const char* fileName) { ... }:
Reads customer data from a file, populating an array of customer structures.
Utility Function:
void printSeparator() { ... }:
Prints a separator line for better visual presentation in the console.
Account Creation Function:
void createAccount(struct Customer* customers, int* numCustomers) { ... }:
Takes user input to create a new customer account, validates the input, and saves
the data to a file.
Transaction Handling Functions:
void performTransaction(struct Customer* customer, char transactionType,
float amount) { ... }:
Records transactions, updates the balance, and ensures transaction limits are not
exceeded.
void deposit(struct Customer* customers, int numCustomers) { ... }:
Handles deposit transactions for a specified account.
void withdraw(struct Customer* customers, int numCustomers) { ... }:
Handles withdrawal transactions for a specified account.
void payBill(struct Customer* customers, int numCustomers) { ... }:
Handles bill payment transactions for a specified account.
Display Functions:
void display(struct Customer* customers, int numCustomers) { ... }:
Displays details of all customer accounts, including account number, name, and
balance.
void displayTransactionHistory(struct Customer* customer, int months) { ...
}:
Displays transaction history for a specific customer within a specified time frame.
Menu and Main Function:
void displayMenu() { ... }:
Displays the main menu options in the console.
int main() { ... }:
The main function where the program execution begins, presenting a menu and
handling user choices.
Memory Allocation:
struct Customer* customers = (struct
Customer*)malloc(MAX_CUSTOMERS * sizeof(struct Customer));:
Allocates memory dynamically for an array of customer structures.
File Operations and Exit:
writeToFile(customers, numCustomers, "complete_customer_data.txt");:
Writes the complete customer data to a file before exiting.
free(customers);:
Frees the dynamically allocated memory for customer data.
exit(0);:
Exits the program with a success code.