Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in C please QUESTION: Figure 1 is an output for a complete code that implements queue concept using arrays. Write a complete code based

image text in transcribed

image text in transcribed

image text in transcribed

code in C please

QUESTION: Figure 1 is an output for a complete code that implements queue concept using arrays. Write a complete code based on conditions (a), (b), (c) and (d): (a) Create a structure name Em pbyee that consists of name and gender as members for this structure. (b) Create three (3) queues as a structure variable for Em pbyee: (i) em pbyeeListMAXQUEUE) queue to store employees information entered by user. (11) em pbyeeM aleListMAXQUEUE] queue to store male employees information. (iii) em pbyeeFem aleListM AXQUEUE) queue to store female employees information. (c) Create seven (7) user-defined functions (In no particular order): (1) void addEm pbyee (int num bero em pbyee), a function to add employee information into em pbyeeListusing the enqueue cept. (ii) von displayEm pbyee (), a function to display the content of em pbyeeListqueue. (iii) void deleteEm pbyee 0), a function to delete employee information from em pbyeeListusing the dequeue concept. (iv) von addM aleEm pbyee (structEm pbyeem ale), a function to add male employee information from em pbyeeListinto em pbyeeM aleListusing the enqueue concept. After the male employee information is added into em pbyeeM alelist, the male employee information at em pbyeeListis deleted. (v) void display a leEm pbyee (), a function to display the content of em pbyeeM aleListqueue. (vi) von addFem a leEm pbyee (struct Em pbyee fem ale), a function to add female employee information from em pbyeeList into em pbyeeFem a llist using the enqueue concept. After the female employee information is added into em pbyeeFem alelist the female employee information at em pbyeeListis deleted. (vii) von displayFem aleEm pbyee (), a function to display the content of em pbyeeFem aleListqueue. 3 (d) The flow of output: At first, the user needs to input the employees' information. Then, the output displays the content of em pbyeeList. Next, based on employee's gender, it will add employee information one by one either into em pbyeeM aleListor em pbyeeFem aeList. After the information is added, it deletes the information from em pbyeeListas shown in Figure 1 one by one. Finally, it will display the content for both em p byeeM alListand em pbyeeFem aeList. Your flow of code and parameter in functions may be different from the conditions (c), but your code must have seven (7) user-defined functions that implement queue and correct flow of output. Enter number of employee:5 Enter employee 1 name : Syahrir Enter employee 1 gender: male Enter employee 2 name : Junaida Enter employee 2 gender: female Enter employee 3 name : Zalili Enter employee 3 gender: female Enter employee 4 name : Zaifa Enter employee 4 gender: female Enter employee 5 name : Azwan Enter employee 5 gender: male Content of Employee queue: Syahrir male Junaida female Zalili female Zaifa female Azwan male Content of Employee queue: Junaida female Zalili female 4 Zaifa Azwan female male Content of Employee queue: Zalili female Zaifa female Azwan male Content of Employee queue: Zaifa female Azwan male Content of Employee queue Azwan male The Employee queue is now empty Content of Male Employee queue: Syahrir male Azwan male Content of Female Employee queue: Junaida female Zalili female Zaifa female . . GENERAL INSTRUCTIONS: This is an open-book test. The HOT will carry out 15% of your final marks. The test paper has 1 (ONE) question with FIVE (5) pages. Accomplish this question individually. You neither allowed to discuss with your classmate or anyone else nor use any tools to exchange or transfer the answer. Any attempt to do so will be considered as cheating and plagiarism in which stern penalty will be imposed to you by your lecturer. Duration of test: 1 1/2 hour (8.30 PM - 10.00 PM) Time for answer submission: 10:00 PM - 10:30 PM Full mark for the HOT is 60 marks. Submit the answer in .c file at KALAM. Create a copy of your answer in another file format (Ms Word) as a backup and submit at Google Form/Drive. . . . Full marks Marks given CO2 Construct a programme by applying the data structure and algorithms technique Correct declaration and initialization of 1. Variable & 1 variables related to queu ess. (front, rear, Structure count) Declaration 2 Correct declaration structure Employee 3 Correct declaration for three queues 3 2 2. Main Function User able to enter number of employee Suitable location and correct syntax for calling the user-define functions Implement a correct looping Correct employee gender comparison 3 1 4 Correct addEm pbyee ) correct local variable declaration-1 appropriate looping -1 user able to enter employee information -2 consist of overflow checking -1 appropriate queue variables manipulation 3 correct assign employee information into queue-2 10 Correct displayEm pbyee correct local variable declaration-1 consist of empty queue checking - 1 appropriate looping to display information -3 . 5 3. User-define functions Correct delete Em pbyee 0 consist of underflow checking -1 appropriate queue variables manipulation-3 call the display queue function-1 3 Correct addM aleEm pbyee (and addFem aleEm pbyee consist of overflow checking for both functions -2 appropriate queue variables manipulation for both functions 4 correct assign employee information into correct queue for both functions 4 4 10 Correct displayM aleEm pbyee () and displayFem aleEm pbyee() correct local variable declaration for both functions -2 consist of empty queue checking for both functions -2 appropriate looping to display information for both functions-6 . 10 TOTAL 60

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions