Estimating the daily revenue of a sample cafeteria

#include <iostream> #include <vector> #include <numeric> using namespace std; double avg_price(vector<double> prices) { return accumulate(prices.begin(), prices.end(), 0.0) / prices.size(); }; struct Cafe { string name; double price; }; class Cafeteria { public: string name; string address; int capacity_seats; int number_tables; int seats_per_table; double utilization; int busy_seats_per_hour; int hours_open = 8; Cafeteria(string nm, string adr, int nt, int st): name(nm), address(adr), number_tables(nt), seats_per_table(st) { get_capacity(); } void get_capacity() { capacity_seats = number_tables * seats_per_table; } void set_utilization(double ut) { utilization = ut; get_busy_seats_per_hour(); } void get_busy_seats_per_hour() { busy_seats_per_hour = (utilization/100) * capacity_seats; } }; int main() { vector<Cafe> cafe_types = { {"Americano (small)", 2.10}, {"Americano (mid size)", 2.45}, {"Americano (large)", 2.65}, {"Capuccino (small)", 2.35}, {"Capuccino (mid size)", 2.70}, {"Capuccino (large)", 3.10}, {"Latte (small)", 2.35}, {"Latte (mid size)", 2.70}, {"Latte (large)", 3.10}, {"Mocha (small)", 2.95}, {"Mocha (mid size)", 3.20}, {"Mocha (large)", 3.55}, {"Espresso (small)", 1.60}, {"Espresso (mid size)", 1.90}, {"Espresso (large)", 2.00}, }; Cafeteria cafeteria("By Wendy", "Cafe Str. 11", 18, 4); cafeteria.set_utilization(30); vector<double> cafe_prices = {}; for(const auto cafe_type : cafe_types) { cafe_prices.push_back(cafe_type.price); } double avg_cafe_price = avg_price(cafe_prices); double clients_alone_rate = 1/4; // assume every 4th client comes alone double clients_with_company_rate = 1 - clients_alone_rate; int avg_stay_time_clients_alone_mins = 10; int avg_stay_time_clients_with_company_mins = 25; double clients_alone_in_hour = 60 / avg_stay_time_clients_alone_mins; double clients_with_company_in_hour = 60 / avg_stay_time_clients_with_company_mins; int busy_seats_per_hour = cafeteria.busy_seats_per_hour; int clients_in_hour = busy_seats_per_hour * (clients_with_company_rate *clients_with_company_in_hour + clients_alone_rate * clients_alone_in_hour); double daily_revenue = clients_in_hour * cafeteria.hours_open * avg_cafe_price; cout << "Approximate daily revenue: $" << daily_revenue << endl; // Approximate daily revenue: $866.88 return 0; }