Write a program segment to display the content of the linked list.

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 17RQ
icon
Related questions
Question
Q2 Answer Q2(a)-Q(d) based on the information given in Figure Q2.
to record daily information of
at Liney Restaurant. The program creates a linked list in
/"This program is
meant
the menu
available
which each node contains data such as menu
name, price per unit,
preparation time, quantity ordered and a pointer. The declaration of
the structures MenuData and MenuNode are given in the program.*/
tinclude <stdio.h>
tinclude <string.h>
tinclude <stdlib.h>
#define SIZE 20
struct Menubata
char menuName (20];
double price PerUnit;
double prepzime;
int quantityordered,
typedef struct Menubata MenuData;
struct MenuNode
MenuData data;
struct MenuNode *next;
typedef struct Menutode MenuNode,
void showPrepTime (MenuNode *fftr):
int main ()
MenuNode *front = NULL, *newNodePtr;
MenuData input Data,
for (int i=l; i<=SIZE, i++)
printf ("\nEnter menu name: "):
gets (inputData.menuName):
printf ("\nEnter price per unit: ");
scanf ("$lf", 5inputData.pricePerUnit);
printf("\nEnter preparation time (hours): "):
scanf ("lf", &input Data.prepTime);
printf ("\nEnter quantity ordered: ");
scanf ("sd", sinputData.quantityordered) :
fflush (stdin):
Transcribed Image Text:Q2 Answer Q2(a)-Q(d) based on the information given in Figure Q2. to record daily information of at Liney Restaurant. The program creates a linked list in /"This program is meant the menu available which each node contains data such as menu name, price per unit, preparation time, quantity ordered and a pointer. The declaration of the structures MenuData and MenuNode are given in the program.*/ tinclude <stdio.h> tinclude <string.h> tinclude <stdlib.h> #define SIZE 20 struct Menubata char menuName (20]; double price PerUnit; double prepzime; int quantityordered, typedef struct Menubata MenuData; struct MenuNode MenuData data; struct MenuNode *next; typedef struct Menutode MenuNode, void showPrepTime (MenuNode *fftr): int main () MenuNode *front = NULL, *newNodePtr; MenuData input Data, for (int i=l; i<=SIZE, i++) printf ("\nEnter menu name: "): gets (inputData.menuName): printf ("\nEnter price per unit: "); scanf ("$lf", 5inputData.pricePerUnit); printf("\nEnter preparation time (hours): "): scanf ("lf", &input Data.prepTime); printf ("\nEnter quantity ordered: "); scanf ("sd", sinputData.quantityordered) : fflush (stdin):
newNodePtr = malloc (sizeof (MenuNode) )
newNodePtr->data = inputData;
newNodeFtr->next = NULL;
if (front==NULL)
front = newNodePtr
else
newNodePtr->next = front;
front = newNodePtr;
return 0,
Figure Q2
(a)
Write a program segment to display the content of the linked list.
Transcribed Image Text:newNodePtr = malloc (sizeof (MenuNode) ) newNodePtr->data = inputData; newNodeFtr->next = NULL; if (front==NULL) front = newNodePtr else newNodePtr->next = front; front = newNodePtr; return 0, Figure Q2 (a) Write a program segment to display the content of the linked list.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Operations of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT