Class Definitions
This commit is contained in:
@@ -1,5 +1,28 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class Address
|
||||
{
|
||||
private:
|
||||
std::string m_street;
|
||||
std::string m_city;
|
||||
int m_pincode;
|
||||
public:
|
||||
Address() :
|
||||
m_street(""),
|
||||
m_city(""),
|
||||
m_pincode(0)
|
||||
{}
|
||||
Address(const std::string& street, const std::string& city, int pincode):
|
||||
m_street(street),
|
||||
m_city(city),
|
||||
m_pincode(pincode)
|
||||
{}
|
||||
std::string getAddress() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 17-02-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "User.h"
|
||||
#include "Order.h"
|
||||
|
||||
using orders = std::vector<Order*>;
|
||||
|
||||
class Customer : public User
|
||||
{
|
||||
orders m_orders;
|
||||
private:
|
||||
void addOrder(Order*);
|
||||
orders& getOrders();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Menu.h"
|
||||
#include "FoodDeliveryController.h"
|
||||
|
||||
class CustomerMenu : public Menu
|
||||
{
|
||||
public:
|
||||
CustomerMenu(FoodDeliveryController& foodDeliveryController) : Menu(foodDeliveryController) {}
|
||||
void showMenu() const override;
|
||||
void handleOperation() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,32 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
class DeliveryAssignment
|
||||
#include "Order.h"
|
||||
|
||||
enum class DeliveryStatus
|
||||
{
|
||||
CREATED,
|
||||
ACCEPTED,
|
||||
DELIVERED
|
||||
};
|
||||
|
||||
class DeliveryAssignment
|
||||
{
|
||||
private:
|
||||
int m_id;
|
||||
Order& m_order;
|
||||
DeliveryStatus m_status;
|
||||
public:
|
||||
DeliveryAssignment(int id, Order& order) :
|
||||
m_id(id),
|
||||
m_order(order),
|
||||
m_status(DeliveryStatus::CREATED)
|
||||
{}
|
||||
int getId() const;
|
||||
DeliveryStatus getStatus() const;
|
||||
Order* getOrder();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 17-02-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "User.h"
|
||||
#include "DeliveryAssignment.h"
|
||||
|
||||
using deliveryAssignments = std::vector<DeliveryAssignment*>;
|
||||
|
||||
class DeliveryPartner : public User
|
||||
{
|
||||
private:
|
||||
deliveryAssignments m_deliveryAssignments;
|
||||
public:
|
||||
void acceptDeliveryAssignment(DeliveryAssignment*);
|
||||
deliveryAssignments& getAssignedDeliveries();
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Menu.h"
|
||||
#include "FoodDeliveryController.h"
|
||||
|
||||
class DeliveryPartnerMenu : public Menu
|
||||
{
|
||||
public:
|
||||
DeliveryPartnerMenu(FoodDeliveryController& foodDeliveryController) : Menu(foodDeliveryController) {}
|
||||
void showMenu() const override;
|
||||
void handleOperation() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "MenuItem.h"
|
||||
|
||||
class Item
|
||||
{
|
||||
};
|
||||
private:
|
||||
MenuItem& m_item;
|
||||
int m_quantity;
|
||||
|
||||
public:
|
||||
Item(MenuItem& item)
|
||||
: m_item(item), m_quantity(0)
|
||||
{}
|
||||
int getQuantity() const {}
|
||||
MenuItem& getMenuItem() {}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include "FoodDeliveryController.h"
|
||||
|
||||
class Menu
|
||||
{
|
||||
private:
|
||||
FoodDeliveryController& m_foodDeliveryController;
|
||||
public:
|
||||
Menu(FoodDeliveryController& foodDeliveryController) : m_foodDeliveryController(foodDeliveryController) {}
|
||||
virtual ~Menu() = default;
|
||||
virtual void showMenu() const = 0;
|
||||
virtual void handleOperation() = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class MenuItem
|
||||
{
|
||||
private:
|
||||
int m_id;
|
||||
std::string m_name;
|
||||
std::string m_description;
|
||||
double m_price;
|
||||
public:
|
||||
MenuItem():
|
||||
m_id(0),
|
||||
m_name(""),
|
||||
m_description(""),
|
||||
m_price(0)
|
||||
{}
|
||||
MenuItem(int id, const std::string& name, const std::string& description, double price):
|
||||
m_id(id),
|
||||
m_name(name),
|
||||
m_description(description),
|
||||
m_price(price)
|
||||
{}
|
||||
int getId() const;
|
||||
std::string getName() const;
|
||||
std::string getDescription() const;
|
||||
void setDescription(const std::string&);
|
||||
double getPrice() const;
|
||||
void setPrice(double);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,45 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
class Order
|
||||
#include <vector>
|
||||
#include "Item.h"
|
||||
|
||||
using items = std::vector<Item>;
|
||||
|
||||
enum class OrderStatus
|
||||
{
|
||||
CREATED,
|
||||
READYFORPICKUP,
|
||||
OUTFORDELIVERY,
|
||||
DELIVERED,
|
||||
CANCELLED
|
||||
};
|
||||
|
||||
class Order
|
||||
{
|
||||
private:
|
||||
int m_id;
|
||||
items m_items;
|
||||
double m_totalAmount;
|
||||
OrderStatus m_status;
|
||||
public:
|
||||
Order():
|
||||
m_id(0),
|
||||
m_totalAmount(0),
|
||||
m_status(OrderStatus::CREATED)
|
||||
{}
|
||||
Order(int id):
|
||||
m_id(id),
|
||||
m_totalAmount(0),
|
||||
m_status(OrderStatus::CREATED)
|
||||
{}
|
||||
~Order();
|
||||
void addItem();
|
||||
void removeItem();
|
||||
items& getItems();
|
||||
double getTotal() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,40 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "MenuItem.h"
|
||||
#include "Order.h"
|
||||
|
||||
using menuItems = std::vector<MenuItem>;
|
||||
using orders = std::vector<Order*>;
|
||||
|
||||
class Restaurant
|
||||
{
|
||||
private:
|
||||
int m_id;
|
||||
std::string m_name;
|
||||
menuItems m_menuItems;
|
||||
orders m_orders;
|
||||
bool m_status;
|
||||
public:
|
||||
Restaurant() :
|
||||
m_id(0),
|
||||
m_name(""),
|
||||
m_status(true)
|
||||
{}
|
||||
Restaurant(int id, const std::string& name) :
|
||||
m_id(id),
|
||||
m_name(name),
|
||||
m_status(true)
|
||||
{}
|
||||
~Restaurant();
|
||||
menuItems& getMenuItems();
|
||||
orders& getOrders();
|
||||
bool getStatus() const;
|
||||
void setStatus(bool);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 17-02-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "User.h"
|
||||
#include "Restaurant.h"
|
||||
#include "MenuItem.h"
|
||||
|
||||
using restaurants = std::vector<Restaurant*>;
|
||||
|
||||
class RestaurantOwner : public User
|
||||
{
|
||||
private:
|
||||
restaurants m_restaurants;
|
||||
public:
|
||||
void addRestaurant(Restaurant*);
|
||||
restaurants& getRestaurants();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 18-12-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "Menu.h"
|
||||
#include "FoodDeliveryController.h"
|
||||
|
||||
class RestaurantOwnerMenu : public Menu
|
||||
{
|
||||
public:
|
||||
RestaurantOwnerMenu(FoodDeliveryController& foodDeliveryController): Menu(foodDeliveryController) {}
|
||||
void showMenu() const override;
|
||||
void handleOperation() override;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,3 +3,17 @@ Author: Joel Mathew Thomas
|
||||
Date: 17-02-2026
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
}
|
||||
catch (const exception& e)
|
||||
{
|
||||
cout << "Exception : " << e.what() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -33,24 +33,15 @@
|
||||
<ClCompile Include="Customer.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CustomerMenu.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeliveryAssignment.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeliveryPartner.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeliveryPartnerMenu.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Item.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Menu.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MenuItem.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
@@ -63,9 +54,6 @@
|
||||
<ClCompile Include="RestaurantOwner.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RestaurantOwnerMenu.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="User.cpp">
|
||||
<Filter>Models</Filter>
|
||||
</ClCompile>
|
||||
@@ -78,6 +66,18 @@
|
||||
<ClCompile Include="FoodDeliveryController.cpp">
|
||||
<Filter>Controller</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Menu.cpp">
|
||||
<Filter>Controller</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RestaurantOwnerMenu.cpp">
|
||||
<Filter>Controller</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DeliveryPartnerMenu.cpp">
|
||||
<Filter>Controller</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CustomerMenu.cpp">
|
||||
<Filter>Controller</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Address.h">
|
||||
@@ -86,24 +86,15 @@
|
||||
<ClInclude Include="Customer.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CustomerMenu.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeliveryAssignment.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeliveryPartner.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeliveryPartnerMenu.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Item.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Menu.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MenuItem.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
@@ -116,9 +107,6 @@
|
||||
<ClInclude Include="RestaurantOwner.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RestaurantOwnerMenu.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="User.h">
|
||||
<Filter>Models</Filter>
|
||||
</ClInclude>
|
||||
@@ -128,5 +116,17 @@
|
||||
<ClInclude Include="FoodDeliveryController.h">
|
||||
<Filter>Controller</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Menu.h">
|
||||
<Filter>Controller</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RestaurantOwnerMenu.h">
|
||||
<Filter>Controller</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DeliveryPartnerMenu.h">
|
||||
<Filter>Controller</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CustomerMenu.h">
|
||||
<Filter>Controller</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,5 +1,44 @@
|
||||
/*
|
||||
Author: Joel Mathew Thomas
|
||||
Date: 17-02-2026
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class User
|
||||
{
|
||||
private:
|
||||
int m_id;
|
||||
std::string m_name;
|
||||
std::string m_phone;
|
||||
std::string m_password;
|
||||
std::string m_email;
|
||||
bool m_isAuthenticated;
|
||||
|
||||
public:
|
||||
User()
|
||||
: m_id(0),
|
||||
m_name(""),
|
||||
m_phone(""),
|
||||
m_password(""),
|
||||
m_email(""),
|
||||
m_isAuthenticated(false)
|
||||
{}
|
||||
User(int id,
|
||||
const std::string& name,
|
||||
const std::string& phone,
|
||||
const std::string& password,
|
||||
const std::string& email)
|
||||
: m_id(id),
|
||||
m_name(name),
|
||||
m_phone(phone),
|
||||
m_password(password),
|
||||
m_email(email),
|
||||
m_isAuthenticated(false)
|
||||
{}
|
||||
virtual ~User() = default;
|
||||
void login();
|
||||
void logout();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user