Write code for the following program in C. As per proper coding practice, plan out your program with psuedocode and include this before the main function.
I visited Fields Museum in Chicago few months ago to look at Mummy’s. You have been asked to write a program that can be used to control the number of people who can be in the exhibition room at the same time. Groups of people can always leave the room (if they are inside), but a group cannot enter the room if they would make the number of people in the room exceed the maximum of 149. There are 5 security guards in the room at all times. Write a program that reads the sizes of the groups that arrive or depart (user can enter those). Use negative numbers for departures. After each input, display the current number of visitors. As soon as the room holds the maximum allowable number of visitors, report that the room is full and stop accepting new groups (i.e., if a new group arrives, display a message stating that the room is full and no entry is allowed until we have room. You may admit some members from the group if possible depending on the available room). Exit the program if no one from 2 consecutive groups can’t enter.
Pseudo Code:
******** CODE *********

#include<stdio.h>
#define MAX 149
int counter = 0;
int people_in_room = 0;
int main(){
int number_of_gaurd = 5;
int size;
int vacant_space;
people_in_room+=number_of_gaurd;
while(1){
printf("Enter the size of group: ");
scanf("%d",&size);
printf("Current number of visitiors %d\n",people_in_room);
vacant_space = MAX - people_in_room;
if(size<0){
people_in_room+=size;
counter = 0;
if(people_in_room<0)
people_in_room=0;
}
else
{
if(vacant_space==0){
printf("room is full and no entry is allowed until we have room\n");
counter++;
}
else if(size<=vacant_space){
people_in_room += size;
counter = 0;
}
else{
people_in_room +=vacant_space;
counter = 0;
}
}
if(counter>2){
printf("Terminating program\n");
return 0;
}
}
}
**********************
I hope it helps
Please revert back to me incase of any query
Have a great day
Write code for the following program in C. As per proper coding practice, plan out your...
Please help me to write a c++ program that will Implement a HotelRoom class, with private data members: the room number, room capacity (representing the maximum number of people the room can accommodate), the occupancy status (0 or the number of occupants in the room), the daily room rate. Member functions include: • a 4-argument constructor that initializes the four data members of the object being created (room number, room capacity, room rate, occupancy status) to the constructor's arguments. The...
I need trying to figure out how I can make create a code in
Python with this exercise for I am having trouble doing so.
Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...
Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....
Write a C++ computer program that simulates the action of an elevator that is out of order. After simulating the motion of the elevator, your program will display a bar chart that shows the number of times the elevator stays on each floor of a twenty-five-story building. When you arrive on the scene to begin studying the elevator, it is on the twelfth floor of the twenty-five-story building. Every five minutes the elevator either moves up one floor or down...
Edit a C program based on the surface code(which is after the question's instruction.) that will implement a customer waiting list that might be used by a restaurant. Use the base code to finish the project. When people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. The program must use a linked list to implement the queue-like data structure....
write a code on .C file
Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...
Requirement Write pseudocode and translate it to ONE C-program for each the following problems. In your pseudocode and C-program, use only what you have learned in this class so far. (Menu) Design a menu for question 2 and 3. So far, you use one program to solve all lab questions. But some of you may feel awkward when you want to demo/test only one lab question. To overcome that, your program should show a menu so that the users of...
Write a C++ program named, gradeProcessor.cpp, that will do the following tasks: -Print welcome message -Generate the number of test scores the user enters; have scores fall into a normal distribution for grades -Display all of the generated scores - no more than 10 per line -Calculate and display the average of all scores -Find and display the number of scores above the overall average (previous output) -Find and display the letter grade that corresponds to the average above (overall...
C Programming write two functions, similar to what you see in the sample program. The first will ask the user to enter some information (I have included the type in parentheses) First Name (char[]) Last Name (char[]) Age (int) Height in Inches (double) Weight in Pounds (double) You will use pass-by-reference to modify the values of the arguments passed in from the main(). Remember that arrays require no special notation, as they are passed by reference automatically, but the other...
Based on Mintzberg, what type of managerial roles do the following people engage? Please justify your answer with examples from the text. • Dale Moser • Moser's Scottish boss Federal transportation officials • Joseph Schwieterman, director of the Chaddick Institute for Metropolitain Development • Brian Izzo, one of Schwieterman's students After the Des Moines bus departs, a dispatcher shouts that Indianapolis-bound travelers can sit on the warming bus." He points to a white coach iding 50 feet up the street....