Our project is an online shopping system which utilizes the abilities of C++ language while abiding by the rules and regulations of OOP. The project is a console application which primarily consists of two pieces of code:
- The networking layer.
- The management layer.
The project has used the windows api of threading and socket programming - Winsock2
library. Therefore, the project can only be compiled to windows machines that support this library. Also, make sure to link the object file with winsock modules.
The networking layer also uses the local host 127.0.0.1
ip as default. You can change it in the Server.h
The networking layer consists of those classes and functions which are responsible for establishing a connection between a client and the remote sever.
The networking is carried out with the help of Winsock (2.2) programming - windows APIs of socket programming.
The Server
- which uses the Thread
class - and Client
class.
The networking layer is independent of the management layer; it can used in any C++ program. You can download the following files and use them in your own project.
- Server: Server.h - Server.cpp and Thread.h - Thread.cpp
- Client: Client.h - Client.cpp
You may utilize the networking functions like:
#include "Server.h"
void worker(Thread& server)
{
// code to deal with client
server.Rec(buffer); // receive a msg from client
server.Send(msg); // send a msg to client
server.endServer(); // close the server
}
int main()
{
Server server(worker);
if (server.start())
server.run();
return 0;
}
#include "Client.h"
int main()
{
Client client;
if (client.start())
{
// code to deal with server
client.Rec(buffer); // receive a msg from server
client.Send(msg); // send a msg to server
}
return 0;
}
This layer uses the networking layer to implement a networked shopping app.
- Customers can sign-up or login.
- Customers can buy items.
- Before confirming, the bill is displayed. Then, they have the option to confirm, cancel, add or remove anything.
- Customers can write complaints.
- Any employee (or admin) can answer the complain.
- Employees and admin will avail 20% discount on purchases.
- Employee accounts are made by the admin.
- Customers and employees alike can view their profile.
- Automatic reorder is placed if goods fall below a certain level.
- Admin can view record of customers & employees.
- Admin can fire any employees and ban any customers.
- Admin can view the inventory level and manually order goods.
- Admin can also manually update balance.
- Admin can search for customers and employees.
- Admin also sets the reorder level, amount & unit price.
For a detailed explanation of everything, refer to this report.
May, 2021
- github : @saad0510
- email : [email protected] or [email protected]