#include "md.h"

 

/******************************************************************************/

/*                                                                            */

/* print out the menu                                                         */

/*                                                                            */

/******************************************************************************/

void print_menu(void)

{

             printf("\n****************************************");

             printf("\n* %1d. Regular hamburger %15d *", REG_HAM_CODE, REG_HAM_PRICE);

             printf("\n* %1d. Double hamburger  %15d *", DBL_HAM_CODE, DBL_HAM_PRICE);

             printf("\n* %1d. Coke              %15d *", COKE_CODE, COKE_PRICE);

             printf("\n* 0. End of order                      *");

             printf("\n****************************************");

}

 

 

/******************************************************************************/

/*                                                                            */

/* print out the receipt                                                      */

/*                                                                            */

/******************************************************************************/

void print_receipt(int no1, int no2, int no3)

{

             int          sub_total;                         /* subtotal */

             int          total = 0;                           /* total price */

 

             if (no1 + no2 + no3)           {

                

                           printf("\n\n Receipt");

 

                           printf("\n----------------------------------------");

 

                           if (no1 > 0) {

                                        sub_total = no1 * REG_HAM_PRICE;

                                        total = total + sub_total;

                                        printf("\n Regular Hamberger : %2d %14d", no1, sub_total);

                           }

                           if (no2 > 0) {

                                        sub_total = no2 * DBL_HAM_PRICE;

                                        total = total + sub_total;

                                        printf("\n Double Hamberger  : %2d %14d", no2, sub_total);

                           }

                           if (no3 > 0) {

                                        sub_total = no3 * COKE_PRICE;

                                        total = total + sub_total;

                                        printf("\n Coke :              %2d %14d", no3, sub_total);

                           }

                           printf("\n----------------------------------------");

                           printf("\n TOTAL: %30d\n", total);

             }

}

 

/******************************************************************************/

/*                                                                            */

/* print out the proceeds                                                     */

/*                                                                            */

/******************************************************************************/

void print_proceeds(int no1, int no2, int no3)

{

             int          sub_total;                         /* subtotal */

             int          total = 0;                           /* total price */

 

             if (no1 + no2 + no3)           {

                

                           printf("\n\n Daily Result");

 

                           printf("\n----------------------------------------");

 

                           if (no1 > 0) {

                                        sub_total = no1 * REG_HAM_PRICE;

                                        total = total + sub_total;

                                        printf("\n Regular Hamberger : %2d %14d", no1, sub_total);

                           }

                           if (no2 > 0) {

                                        sub_total = no2 * DBL_HAM_PRICE;

                                        total = total + sub_total;

                                        printf("\n Double Hamberger  : %2d %14d", no2, sub_total);

                           }

                           if (no3 > 0) {

                                        sub_total = no3 * COKE_PRICE;

                                        total = total + sub_total;

                                        printf("\n Coke :              %2d %14d", no3, sub_total);

                           }

                           printf("\n----------------------------------------");

                           printf("\n TOTAL: %30d\n", total);

             }

}