#include "Restaurant.h" #include int Restaurant::indexOf(const Product& prod) { for (int i = 0; i < productsCount; i++) { if (strcmp(products[i].get_name(), prod.get_name()) == 0) return i; } return -1; } Restaurant::Restaurant() : Restaurant("") {} Restaurant::Restaurant(const char* name) { strcpy(this->name, name); products = new Product[8]; productsCount = 0; } void Restaurant::addProduct(Product prod) { products[productsCount++] = prod; } unsigned int Restaurant::giveOrder(Order order) { unsigned int time = 0; for (int i = 0; i < order.get_productCount(); i++) { if (indexOf(order.get_products()[i]) < 0) throw 1; time += strlen(order.get_products()[i].get_name()) * 2.7182818284590452353602874 * 3.14159265358979323846; } return time; }