Question: Code using C , only function calls in main function. The user defined functions should include only single return statement and do a single task.

 Code using C , only function calls in main function. The Code using C , only function calls in main function. The user defined functions should include only single return statement and do a single task. Only use of loops , arrays and if statements is permited

Problem: The students at Springfield Elementary School have the option to select each day whether they will receive the hot lunch prepared by the school (option l) or to indicate that they have brought with them their own lunch from home (option 2) Each class has a maximum size of 30 students. Given the ID numbers of each student (positive integer values) and their lunch preferences for the day, place the students in line with the hot lunch students first followed by those who brought their own lunch last. Within each status (1,2) sort the students by their student ID numbers. Example Execution #1: Ento up to 30 tudent ID 38 46 22 29 17 11 31 49 51 9 -1 1 1 1 1 2 2 1 1 1 1 Ente r lunch preferences for the class h li 9 22 29 31 38 46 49 51 11 12 Example Execution #1 Explained: Eight of the ten students are going to participate in the hot lunch program for the day and the remaining two students {11, 17) brought their own lunches. Notice that the lunch preferences correspond to the order in which the student ID numbers were entered. Example Execution #2: p to 30 tudent ID it 38 46 22 29 17 11 31 49 519 1 2 1 1 2 2 1 1 1 2 Enter lunch preferences for the class Order of lunch line 22 29 31 38 49 51 11 17 46 Example Execution t3 Enter up to 30 student ID numbers or -1 to exit: 81 34 21 17 45 90 67 73 72 13 22 Enter lunch preferences for the class 1 2 2 1 2 1 1 1 2 2 1 Order of lunch line 17 22 67 73 81 90 13 21 34 45 72 Example Execution #4 (full class of 30, no -1 needed to exit): 10 20 30 40 50 11 21 31 41 51 12 Enter up to 30 student ID numbers or 1 to exit 22 32 2 52 13 23 3 3 53 14 24 34 4 54 15 25 35 5 55 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 1 2 1 2 1 2 1. Enter lunch preferences for the class 2 1 2 1 2 1 2 1. Order of lunch line 0 12 13 15 20 22 24 30 32 33 35 40 42 44 50 52 53 55 11 1 21 23 25 31 34 4 43 45 51 54 Example Execution #5 (input validation requirements demonstrated: to exit: 15 1 S 2 20 40 35 30 55 4S 15 Enter up to 30 atudent ID 1 Error! All student ID numbers must be unique Enter up to 30 student ID numbers or 1 to exit 15 1 25 20 40 35 30 55 45 65 th 2 2 2 2 2 2 0 1 1 1 1 Invalid preference entered! Please try again lunch p th 2 2 2 2 2 2 1 1 1 1 1 Order of lunch line: 30 35 45 55 65 S 10 15 20 25 40 Additional Notes: The maximum number of student ID numbers is 30. A value of -1 may be entered if the class size is less than 30 to indicate the end of input. All student ID numbers entered will be positive (greater than zero) and will into the int data type. The number of preferences provided will always match the number of students previously entered The program must validate that all student ID numbers are unique and that the preferences can only contain numbers 1 and 2 as shown above, In both cases, if an error is found, the entire list of numbers will be re-entered. Course standards prohibit the use of programming concepts not yet introduced in lecture. For this assignment, you can consider all material in the first 8 chapters of the book, notes, and lectures

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!