You are tasked with creating a program for a pizza shop –however, as this is a comparative languages course,.you will be creating the same application in the following programming languages:
Code Description Document C:
Our C code is a combination of two files
This file is the class having the main function. It uses the other file “Pizza.c” for its functionality. We have added an import for this Pizza.c file in this.
The main function contains a loop which asks the user for one of three choices and then passes the control to Pizza.c file for the functionality of that function.
printf("nnPizza Choices n");
printf("1. New Ordern");
printf("2. Display list of ordersn");
printf("Enter your choice : ");
fgets(val, 5, stdin);
printf("Please enter a valid choice.");
This is the main file which performs various functionalities related to this application.
It has two structures:
typedef struct pizza
This Pizza structure denotes a Pizza.
It has three attributes:
size: size of pizza (small/medium/large
toppings : it can contain 5 toppings
tsize: it contains the number of toppings this pizza have
typedef struct pizzaorder
Pizza ** pizzas;
This structure have various attributes like:
pizzas: an array of pizza pointers
status: status of the order
name : name of the person
phone: phone number
address: address of the person
size: size of the pizza array
There are a number of functions like:
void printPizza(Pizza *pizza)
printf("Size : %sn",pizza->size);
printf("Toppings : n" );
This function prints the passed pizza pointer with its size and all other details
double pizzaCost(Pizza* pizza)
This function makes a Pizza Order. Read various pizzas for this order and add this order to the list of orders.
printf("nList of Orders: n");
This function prints all the orders with the brief details about each order.