Code Monkey home page Code Monkey logo

cafeteria_menu_system's Introduction

Cafeteria_Menu_System

This C code implements a cafeteria menu system that calculates the monthly income based on menu details and total sales. The code utilizes a global structure named "cafeteria" which consists of three different arrays and the name of the month for the given menu. The structure is defined as follows:

typedef struct {
    char* date;
    char* soup;
    char* main_dish;
    char* side_dish;
    char* extra;
    int sale_count[3];
} Menu;

The "cafeteria" structure contains pointers for the normal menu array, vegan menu array, and vegetarian menu array. Each array holds menu structs corresponding to the number of days food has been served in a month.

The code provides the following functions:

void initialize_menus(Cafeteria *cafeteria, char *csv_file_name)

This function initializes the global "cafeteria" struct and menu structs by reading the menu details from a CSV file. The name of the month is extracted from the CSV file name. All count arrays for each day are initialized as 0. Dynamic memory allocation is used appropriately.

void record_customer_counts(Cafeteria *cafeteria)

This function generates random customer counts for each type (student, academic personal, administrative personal) for each menu of each day in the cafeteria. The count arrays for each type are updated according to the random counts. Random numbers range from 0 to 50.

void calc_and_show_income(Cafeteria *cafeteria)

This function calculates and displays the total income in three different ways:

a. The distribution of the total gained money on the type of menus.

b. Overall sales for a month using the customer counts within each menu.

c. Total sales income of the whole month.

The prices for each customer type are fixed (student: 6 TL, academic personal: 16 TL, administrative personal: 12 TL), and the type of menu does not affect the price.

You can call these functions with the initialized cafeteria struct as input to obtain the sales results at the end of the month.

cafeteria_menu_system's People

Contributors

ncrefe avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.