0% found this document useful (0 votes)
18 views11 pages

Module 1 Customer Managment

The document outlines three modules for managing a retail system: Customer Management, Product Management, and Employee Management. Each module includes user stories, pseudocode, flowcharts, and code snippets to facilitate functionalities such as product viewing, purchasing, and employee record management. The code examples demonstrate how to implement these features in C programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views11 pages

Module 1 Customer Managment

The document outlines three modules for managing a retail system: Customer Management, Product Management, and Employee Management. Each module includes user stories, pseudocode, flowcharts, and code snippets to facilitate functionalities such as product viewing, purchasing, and employee record management. The code examples demonstrate how to implement these features in C programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Module 1: Customer Managment

1.1 User Story


As a customer, I want to view available products and purchase items, so that I can buy what I
need and get the total bill. Besides this supershop is placed at the middle of the town, as a
result everyone can visit here and buy their necessary products.
1.2 Pseudocode
Start
Display list of products
Ask user for their name
Repeat
Ask user to enter Product ID
If Product ID is 0, break loop
Check if Product ID is valid
Ask for quantity
If quantity is available
Calculate total price
Reduce product stock
Add to total bill
Else
Show "Insufficient stock"
End Repeat
Show total bill with customer name
Add total to overall sales
Thank the customer
End
1.3 Flowchart

1.4 Code
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_CUSTOMERS 50
struct Customer {
char name[50];
int id;
float totalSpent;
};
void manageCustomers() {
char name[50];
int productID, quantity;
float total = 0;
displayProducts();
printf("\nEnter your name: ");
scanf("%s", name);

while (1) {
printf("Enter product ID to buy (0 to finish): ");
scanf("%d", &productID);
if (productID == 0) break;
if (productID > 0 && productID <= productCount) {
printf("Enter quantity: ");
scanf("%d", &quantity);
if (quantity <= products[productID - 1].quantity) {
float price = quantity * products[productID - 1].price;
total += price;
products[productID - 1].quantity -= quantity;
printf("Added to cart: %s x%d = %.2f\n", products[productID - 1].name, quantity,
price);
} else {
printf("Insufficient stock.\n");
}
} else {
printf("Invalid product ID.\n");
}
}
printf("\nTotal bill for %s: %.2f\n", name, total);
totalSales += total;
printf("\nTHANK YOU Dear Customer\n");
}
1.5 Input and Output
Input

Output

Module 2: Product Managment


2.1 User Story
As a store manager, I want to be able to manage product information (like adding new
products, editing existing ones, viewing all products, and monitoring stock levels), so that I
can keep the inventory up to date and avoid stockouts or overstocking.
2.2 Pseudocode
START
DISPLAY product management menu:
1. View all products
2. Add a new product
3. Edit existing product
4. Search product by name
5. Alert for low stock
Get user choice
IF choice == 1:
DISPLAY all products with ID, Name, Price, Quantity
ELSE IF choice == 2:
INPUT product name, price, quantity
ADD product to product list
ELSE IF choice == 3:
INPUT product ID
IF product found:
INPUT new name/price/quantity
UPDATE product info
ELSE:
DISPLAY "Product not found"
ELSE IF choice == 4:
INPUT product name
SEARCH and DISPLAY matched products
ELSE IF choice == 5:
FOR each product:
IF quantity < threshold (e.g., 10):
DISPLAY warning
ELSE:
DISPLAY "Invalid choice"

END

2.3 Flowchart

2.4 Code
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define MAX_PRODUCTS 100


truct Product {
int id;
char name[50];
float price;
int quantity;
};

struct Product products[100];


int productCount = 0;

void addProduct() {
printf("\nEnter Product ID: ");
scanf("%d", &products[productCount].id);
printf("Enter Product Name: ");
scanf(" %[^\n]", products[productCount].name);
printf("Enter Product Price: ");
scanf("%f", &products[productCount].price);
printf("Enter Product Quantity: ");
scanf("%d", &products[productCount].quantity);
productCount++;
printf("Product added successfully!\n");
}

void viewProducts() {
printf("\nProduct List:\n");
printf("ID\tName\t\tPrice\tQuantity\n");
for (int i = 0; i < productCount; i++) {
printf("%d\t%s\t\t%.2f\t%d\n", products[i].id, products[i].name, products[i].price,
products[i].quantity);
}
}

void searchProduct() {
char searchName[50];
printf("\nEnter product name to search: ");
scanf(" %[^\n]", searchName);
int found = 0;
for (int i = 0; i < productCount; i++) {
if (strcmp(products[i].name, searchName) == 0) {
printf("Product Found: ID: %d, Name: %s, Price: %.2f, Quantity: %d\n",
products[i].id, products[i].name, products[i].price, products[i].quantity);
found = 1;
}
}
if (!found)
printf("Product not found.\n");
}
void updateProduct() {
int id;
printf("\nEnter Product ID to update: ");
scanf("%d", &id);
for (int i = 0; i < productCount; i++) {
if (products[i].id == id) {
printf("Enter new name: ");
scanf(" %[^\n]", products[i].name);
printf("Enter new price: ");
scanf("%f", &products[i].price);
printf("Enter new quantity: ");
scanf("%d", &products[i].quantity);
printf("Product updated!\n");
return;
}
}
printf("Product with ID %d not found.\n", id);
}

void lowStockAlert() {
printf("\nProducts with low stock (less than 10):\n");
for (int i = 0; i < productCount; i++) {
if (products[i].quantity < 10) {
printf("ID: %d, Name: %s, Quantity: %d\n", products[i].id, products[i].name,
products[i].quantity);
}
}
}

int main() {
int choice;
while (1) {
printf("\n--- Product Management Menu ---\n");
printf("1. View Products\n2. Add Product\n3. Search Product\n4. Update Product\n5.
Low Stock Alert\n6. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);
switch (choice) {
case 1: viewProducts(); break;
case 2: addProduct(); break;
case 3: searchProduct(); break;
case 4: updateProduct(); break;
case 5: lowStockAlert(); break;
case 6: return 0;
default: printf("Invalid choice!\n");
}
}
return 0;
}
2.5 Input and Output

Module 3: Employee Managment


3.1 User Story
As an admin, I want to add, update, view, and delete employee records so I can manage the
workforce efficiently.
3.2 Pseudocode
Start
Display Employee Menu
1. Add Employee
2. View Employees
3. Update Employee
4. Delete Employee
If user chooses Add:
Input ID, Name, Position, Salary
Store in employee file
If View:
Read from file and display all
If Update:
Search by ID and edit fields
If Delete:
Search by ID and remove from file
End

3.3 Flowchart

3.4 Code
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_EMPLOYEES 20
struct Employee {
int id;
char name[50];
char position[50];
float salary;
};

struct Employee employees[100];


int empCount = 0;

void addEmployee() {
printf("\nEnter Employee ID: ");
scanf("%d", &employees[empCount].id);
printf("Enter Name: ");
scanf(" %[^\n]", employees[empCount].name);
printf("Enter Position: ");
scanf(" %[^\n]", employees[empCount].position);
printf("Enter Salary: ");
scanf("%f", &employees[empCount].salary);
empCount++;
printf("Employee added successfully!\n");
}

void viewEmployees() {
printf("\n--- Employee List ---\n");
for(int i = 0; i < empCount; i++) {
printf("ID: %d, Name: %s, Position: %s, Salary: %.2f\n",
employees[i].id,
employees[i].name,
employees[i].position,
employees[i].salary);
}
}

void searchEmployee() {
int id;
printf("\nEnter Employee ID to Search: ");
scanf("%d", &id);
for(int i = 0; i < empCount; i++) {
if(employees[i].id == id) {
printf("ID: %d, Name: %s, Position: %s, Salary: %.2f\n",
employees[i].id,
employees[i].name,
employees[i].position,
employees[i].salary);
return;
}
}
printf("Employee not found.\n");
}

void updateEmployee() {
int id;
printf("\nEnter Employee ID to Update: ");
scanf("%d", &id);
for(int i = 0; i < empCount; i++) {
if(employees[i].id == id) {
printf("Enter New Name: ");
scanf(" %[^\n]", employees[i].name);
printf("Enter New Position: ");
scanf(" %[^\n]", employees[i].position);
printf("Enter New Salary: ");
scanf("%f", &employees[i].salary);
printf("Employee updated successfully.\n");
return;
}
}
printf("Employee not found.\n");
}

void deleteEmployee() {
int id;
printf("\nEnter Employee ID to Delete: ");
scanf("%d", &id);
for(int i = 0; i < empCount; i++) {
if(employees[i].id == id) {
for(int j = i; j < empCount - 1; j++) {
employees[j] = employees[j + 1];
}
empCount--;
printf("Employee deleted successfully.\n");
return;
}
}
printf("Employee not found.\n");
}

void employeeManagementMenu() {
int choice;
do {
printf("\n--- Employee Management Menu ---\n");
printf("1. Add Employee\n2. View Employees\n3. Search Employee\n4. Update
Employee\n5. Delete Employee\n6. Back\n");
printf("Enter choice: ");
scanf("%d", &choice);
switch(choice) {
case 1: addEmployee(); break;
case 2: viewEmployees(); break;
case 3: searchEmployee(); break;
case 4: updateEmployee(); break;
case 5: deleteEmployee(); break;
case 6: printf("Returning to Main Menu...\n"); break;
default: printf("Invalid choice!\n");
}
} while(choice != 6);
}

1.5 Input and Output

Input

Output

You might also like