with the three basic information of a tuition class. (b) Based on the function prototype of insertData() function and also how it is called by main() function, write the function definition for this insertData() function which will store data from Table Q1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

(a) Based on the function prototype of addTuition(), write the function definition for this addTuition() function that will prepare a new node of a linked list filled with the three basic information of a tuition class.

(b) Based on the function prototype of insertData() function and also how it is called by main() function, write the function definition for this insertData() function which will store data from Table Q1 in a linked list format.

(c) In the main() function, by using while loop, write C code to display print the information of all tuition classes and the average number of enrolled students, as shown in Figure Q1.

A tuition centre conducts three classes for primary school students as listed in
Table Q1.
Table Q1
Subject
English
Science
No.
Number of Students
Day
Monday
Tuesday
Friday
1.
35
2.
42
3.
Maths
63
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Tuition{
char subject [20];
char day [20];
int num;
struct Tuition *next;
};
struct Tuition *addTuition (char subject[],char day[], int num) ;
void insertData (struct Tuition *curr);
int main ()
struct Tuition *head = NULL, +curr = NULL;
head = curr = addTuition ("","",0);
insertData (curr);
/*Part (c) - Display data and average number of students */
return 0;
/*Part (a) - Function Defintion for addTuition */
/*Part (b) - Function Defintion for insertData */
Subject
Day
Number of Students
English
Science
Monday
Tuesday
Friday
35
42
Maths
63
Average number of enrolled students = 46.67
Figure QI
Transcribed Image Text:A tuition centre conducts three classes for primary school students as listed in Table Q1. Table Q1 Subject English Science No. Number of Students Day Monday Tuesday Friday 1. 35 2. 42 3. Maths 63 #include <stdio.h> #include <string.h> #include <stdlib.h> struct Tuition{ char subject [20]; char day [20]; int num; struct Tuition *next; }; struct Tuition *addTuition (char subject[],char day[], int num) ; void insertData (struct Tuition *curr); int main () struct Tuition *head = NULL, +curr = NULL; head = curr = addTuition ("","",0); insertData (curr); /*Part (c) - Display data and average number of students */ return 0; /*Part (a) - Function Defintion for addTuition */ /*Part (b) - Function Defintion for insertData */ Subject Day Number of Students English Science Monday Tuesday Friday 35 42 Maths 63 Average number of enrolled students = 46.67 Figure QI
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY