C Programming Market
Project ID: 1235668029
Project Details
- Status: Closed (Cancelled)
- Posted: 2/26/2009 at 12:07 EST
- Cancelled: 3/11/2009 at 1:02 EST
- Project Creator: (No Feedback Yet)
- Budget: $50
- Description: Has to be done in C and completed by Sunday March 1st and sent to be and approved before money is sent
The Problem
The school lacks a credible grocery store on campus. After a year of getting lousy over-priced food in the convenience store in the Student Union, you and all of your friends are frustrated. One of your friends majoring in Business comes up with the brilliant idea of opening a grocery store on campus. But, they need your help to decide if their idea is viable or not. Your job will be to run various simulations of customers in line.
The model for the store is as follows:
Normally, there will be three lines in operation or customers to buy their groceries. Each line will have a capacity of 8 customers. The first line (line A) will only be for customers with 10 or fewer items. The other two lines (line B and C) will be for all customers. When a customer is ready to check out, here is how they decide what line to go to:
If the customer has 10 or fewer items and the “Express” line has space, they enter that line.
In all other cases, customers will alternate getting into line B and line C (starting with line B), unless one of the lines is full, in which case they will enter the line that is not full. It will be guaranteed that no more lines will be needed to serve all the customers.
For each customer, you'll be given the following information:
1)His/her name (an uppercase alphabetic string of fewer than 30 characters)
2)The number of items they are buying
3)The time they arrive in line, in seconds after 1 pm. (This makes reading in the data easier.)
For the purposes of the simulation, the store will be open from 1pm to 8pm and all customers who get in line by 8pm will get to buy their items (even though some of them might technically check out with the cashier after 8pm.) It is guaranteed that none of these late checkouts will go past 11:59:59pm. (Thus, all customers will get into a line in between 1pm and 8pm inclusive, and all customers will get checked out in between 1pm and 11:59:59pm, inclusive.)
The information in the input file will be given in the order that the customers arrive to get into a line. At that time, they should be placed in the appropriate line immediately. No two customers will arrive to get into line at the exact same time or have the same name.
The number of seconds it takes a customer to check out of line once they've gotten to the front of it is 40 plus five times the number of items they are buying. Thus, if they are buying 6 items, it will take them 40 + 5(6) = 70 seconds.
Your task will be to print out an output log of each action for each of the lines in UCF-Mart, namely a list of when each customer gets in line and when each one checks out.
Input File Specification (customer.txt)
The input file has a single positive integer, n, on its first line, specifying the number of total days to run the simulation. Each of the simulations will follow.
The first line of each simulation will contain a single positive integer, k, representing the number of customers who get into line for that day of the simulation. The following k lines will contain information about each customer and will be in the order in which they arrive to get in line. The first piece of information on each of these lines will be a non-negative integer (less than or equal to 25200) representing the number of seconds after 1pm the customer arrives to get into line. This is followed by the name of the customer (all uppercase letters with a length of fewer than 30 characters). The final piece of information on each line will be the number of items they are buying, which will be a positive integer less than 1000. As previously mentioned, the data will be such that the last checkout occurs at or before 11:59:59pm. Also, the data will be set up so that no two actions (customers getting into or out of line) occur at exactly the same time. All three pieces of information will be separated by a space on each line.
Output Specification
For each input case, print out a header with the following format:
Day #d:
where d represents the day of the simulation (1 ≤ d ≤ n).
Follow this with a blank line.
The following 2k lines will give information about a customer either getting into a line, or checking out of a line. These lines should be printed in the order in which the actions occur.
If a customer is checking in, print out a statement with the following format:
TIME: Customer NAME checking in line X.
where TIME is the time the customer checked in, NAME is the name of the customer, and X is the letter of the line (A, B, C or D) that the customer is entering.
The time should be printed out in the following format:
(H)H:MM:SSpm
The first one (or possibly two) digits represent the hour. This is followed by a colon and then the next two digits represent the minute (e.g. printf("%.2d\n", 3);). Finally, the last two digits represent the second, printed in a similar format to the minute. (It probably makes sense to have a function that takes in as input the number of seconds after 1pm and in turn prints out the corresponding time in this format.)
If a customer is checking out, print out a line with the following format:
TIME: Customer NAME checking out of line X waited Y seconds.
TIME, NAME and X are defined previously, and Y is a positive integer representing the number of seconds from when the customer got in line to when they finished checking out. (Thus, this wait time includes the time it took for them to get their groceries scanned and paid for. So, the fastest possible wait time is 46 seconds, based on the formula given.)
Follow each day's output with two blank lines.
Implementation Restrictions
You must create a struct that stores a queue. You must write functions that operate on this struct analogous to the queue functions shown in class. Your program must make a queue variable for each of the lines in the simulation. You may implement your queue with either an array or a linked list, but make sure you find a reasonable solution to limiting the line sizes to 10.
Sample Input:
2
15
1 ANNA 5
2 BOB 17
3 CAROL 3
4 DAN 99
5 EMMA 15
6 FRANK 14
7 GARY 13
8 HAROLD 12
9 IVY 11
10 JAKE 9
11 KERI 16
12 LAMAR 19
13 MONICA 20
14 NATHAN 127
15 OLIVIA 2
56
1 ANNA 5
2 BOB 17
3 CAROL 3
4 DAN 99
5 EMMA 15
6 FRANK 14
7 GARY 13
8 HAROLD 12
9 IVY 11
10 JAKE 9
11 KERI 16
12 LAMAR 19
13 MONICA 20
14 NATHAN 127
15 OLIVIA 2
100 POLLY 3
200 QUINN 9
300 ROBERT 12
400 SARAH 19
600 TOM 37
800 UMA 12
1000 VICTOR 6
1200 WENDY 14
1400 XAVIER 3
1600 YASMIN 11
1800 NEWA 10
1810 NEWB 10
1820 NEWC 10
1830 NEWD 10
1840 NEWE 10
1850 NEWF 10
1860 NEWG 10
1870 NEWH 11
1880 NEWI 10
1890 NEWJ 10
1900 NEWK 10
1910 NEWL 10
1920 NEWM 10
1930 NEWN 10
1940 NEWO 10
1950 NEWP 10
1960 NEWQ 10
1961 NEWR 10
1970 NEWS 10
1971 NEWT 10
1980 NEWU 10
1990 NEWV 10
2001 NEWW 10
2010 NEWX 10
2021 NEWY 10
2030 NEWZ 10
25000 MINORJERK 413
25100 OTHER 50
25197 JERKA 1000
25198 JERKB 1000
25199 JERKC 1000
Sample Output:
Day #1:
1:00:01pm: Customer ANNA checking in line A.
1:00:02pm: Customer BOB checking in line B.
1:00:03pm: Customer CAROL checking in line A.
1:00:04pm: Customer DAN checking in line C.
1:00:05pm: Customer EMMA checking in line B.
1:00:06pm: Customer FRANK checking in line C.
1:00:07pm: Customer GARY checking in line B.
1:00:08pm: Customer HAROLD checking in line C.
1:00:09pm: Customer IVY checking in line B.
1:00:10pm: Customer JAKE checking in line A.
1:00:11pm: Customer KERI checking in line C.
1:00:12pm: Customer LAMAR checking in line B.
1:00:13pm: Customer MONICA checking in line C.
1:00:14pm: Customer NATHAN checking in line B.
1:00:15pm: Customer OLIVIA checking in line A.
1:01:11pm: Customer ANNA checking out of line A waited 70 seconds.
1:02:09pm: Customer CAROL checking out of line A waited 126 seconds.
1:02:24pm: Customer BOB checking out of line B waited 142 seconds.
1:03:43pm: Customer JAKE checking out of line A waited 213 seconds.
1:04:34pm: Customer EMMA checking out of line B waited 269 seconds.
1:04:35pm: Customer OLIVIA checking out of line A waited 260 seconds.
1:06:32pm: Customer GARY checking out of line B waited 385 seconds.
1:08:18pm: Customer IVY checking out of line B waited 489 seconds.
1:10:38pm: Customer DAN checking out of line C waited 634 seconds.
1:10:52pm: Customer LAMAR checking out of line B waited 640 seconds.
1:12:42pm: Customer FRANK checking out of line C waited 756 seconds.
1:14:34pm: Customer HAROLD checking out of line C waited 866 seconds.
1:16:50pm: Customer KERI checking out of line C waited 999 seconds.
1:19:30pm: Customer MONICA checking out of line C waited 1157 seconds.
1:24:14pm: Customer NATHAN checking out of line B waited 1440 seconds.
Day #2:
1:00:01pm: Customer ANNA checking in line A.
1:00:02pm: Customer BOB checking in line B.
1:00:03pm: Customer CAROL checking in line A.
1:00:04pm: Customer DAN checking in line C.
1:00:05pm: Customer EMMA checking in line B.
1:00:06pm: Customer FRANK checking in line C.
1:00:07pm: Customer GARY checking in line B.
1:00:08pm: Customer HAROLD checking in line C.
1:00:09pm: Customer IVY checking in line B.
1:00:10pm: Customer JAKE checking in line A.
1:00:11pm: Customer KERI checking in line C.
1:00:12pm: Customer LAMAR checking in line B.
1:00:13pm: Customer MONICA checking in line C.
1:00:14pm: Customer NATHAN checking in line B.
1:00:15pm: Customer OLIVIA checking in line A.
1:01:11pm: Customer ANNA checking out of line A waited 70 seconds.
1:01:40pm: Customer POLLY checking in line A.
1:02:09pm: Customer CAROL checking out of line A waited 126 seconds.
1:02:24pm: Customer BOB checking out of line B waited 142 seconds.
1:03:20pm: Customer QUINN checking in line A.
1:03:43pm: Customer JAKE checking out of line A waited 213 seconds.
1:04:34pm: Customer EMMA checking out of line B waited 269 seconds.
1:04:35pm: Customer OLIVIA checking out of line A waited 260 seconds.
1:05:00pm: Customer ROBERT checking in line C.
1:05:33pm: Customer POLLY checking out of line A waited 233 seconds.
1:06:32pm: Customer GARY checking out of line B waited 385 seconds.
1:06:40pm: Customer SARAH checking in line B.
1:07:07pm: Customer QUINN checking out of line A waited 227 seconds.
1:08:18pm: Customer IVY checking out of line B waited 489 seconds.
1:10:00pm: Customer TOM checking in line C.
1:10:38pm: Customer DAN checking out of line C waited 634 seconds.
1:10:52pm: Customer LAMAR checking out of line B waited 640 seconds.
1:12:42pm: Customer FRANK checking out of line C waited 756 seconds.
1:13:20pm: Customer UMA checking in line B.
1:14:34pm: Customer HAROLD checking out of line C waited 866 seconds.
1:16:40pm: Customer VICTOR checking in line A.
1:16:50pm: Customer KERI checking out of line C waited 999 seconds.
1:17:56pm: Customer VICTOR checking out of line A waited 76 seconds.
1:19:30pm: Customer MONICA checking out of line C waited 1157 seconds.
1:20:00pm: Customer WENDY checking in line C.
1:21:22pm: Customer ROBERT checking out of line C waited 982 seconds.
1:23:20pm: Customer XAVIER checking in line A.
1:24:14pm: Customer NATHAN checking out of line B waited 1440 seconds.
1:24:18pm: Customer XAVIER checking out of line A waited 58 seconds.
1:25:44pm: Customer TOM checking out of line C waited 944 seconds.
1:26:40pm: Customer YASMIN checking in line B.
1:26:48pm: Customer SARAH checking out of line B waited 1208 seconds.
1:27:48pm: Customer WENDY checking out of line C waited 468 seconds.
1:28:40pm: Customer UMA checking out of line B waited 920 seconds.
1:30:00pm: Customer NEWA checking in line A.
1:30:10pm: Customer NEWB checking in line A.
1:30:20pm: Customer NEWC checking in line A.
1:30:26pm: Customer YASMIN checking out of line B waited 226 seconds.
1:30:30pm: Customer NEWD checking in line A.
1:30:40pm: Customer NEWE checking in line A.
1:30:50pm: Customer NEWF checking in line A.
1:31:00pm: Customer NEWG checking in line A.
1:31:10pm: Customer NEWH checking in line C.
1:31:20pm: Customer NEWI checking in line A.
1:31:30pm: Customer NEWJ checking in line B.
1:31:40pm: Customer NEWK checking in line C.
1:31:40pm: Customer NEWA checking out of line A waited 100 seconds.
1:31:50pm: Customer NEWL checking in line A.
1:32:00pm: Customer NEWM checking in line B.
1:32:10pm: Customer NEWN checking in line C.
1:32:20pm: Customer NEWO checking in line B.
1:32:30pm: Customer NEWP checking in line C.
1:32:40pm: Customer NEWQ checking in line B.
1:32:41pm: Customer NEWR checking in line C.
1:32:50pm: Customer NEWS checking in line B.
1:32:51pm: Customer NEWT checking in line C.
1:32:56pm: Customer NEWH checking out of line C waited 106 seconds.
1:33:00pm: Customer NEWU checking in line B.
1:33:10pm: Customer NEWV checking in line C.
1:33:10pm: Customer NEWJ checking out of line B waited 100 seconds.
1:33:20pm: Customer NEWB checking out of line A waited 190 seconds.
1:33:21pm: Customer NEWW checking in line A.
1:33:30pm: Customer NEWX checking in line B.
1:33:41pm: Customer NEWY checking in line C.
1:33:50pm: Customer NEWZ checking in line B.
1:34:36pm: Customer NEWK checking out of line C waited 176 seconds.
1:34:50pm: Customer NEWM checking out of line B waited 170 seconds.
1:35:00pm: Customer NEWC checking out of line A waited 280 seconds.
1:36:16pm: Customer NEWN checking out of line C waited 246 seconds.
1:36:30pm: Customer NEWO checking out of line B waited 250 seconds.
1:36:40pm: Customer NEWD checking out of line A waited 370 seconds.
1:37:56pm: Customer NEWP checking out of line C waited 326 seconds.
1:38:10pm: Customer NEWQ checking out of line B waited 330 seconds.
1:38:20pm: Customer NEWE checking out of line A waited 460 seconds.
1:39:36pm: Customer NEWR checking out of line C waited 415 seconds.
1:39:50pm: Customer NEWS checking out of line B waited 420 seconds.
1:40:00pm: Customer NEWF checking out of line A waited 550 seconds.
1:41:16pm: Customer NEWT checking out of line C waited 505 seconds.
1:41:30pm: Customer NEWU checking out of line B waited 510 seconds.
1:41:40pm: Customer NEWG checking out of line A waited 640 seconds.
1:42:56pm: Customer NEWV checking out of line C waited 586 seconds.
1:43:10pm: Customer NEWX checking out of line B waited 580 seconds.
1:43:20pm: Customer NEWI checking out of line A waited 720 seconds.
1:44:36pm: Customer NEWY checking out of line C waited 655 seconds.
1:44:50pm: Customer NEWZ checking out of line B waited 660 seconds.
1:45:00pm: Customer NEWL checking out of line A waited 790 seconds.
1:46:40pm: Customer NEWW checking out of line A waited 799 seconds.
7:56:40pm: Customer MINORJERK checking in line C.
7:58:20pm: Customer OTHER checking in line B.
7:59:57pm: Customer JERKA checking in line C.
7:59:58pm: Customer JERKB checking in line B.
7:59:59pm: Customer JERKC checking in line C.
8:04:00pm: Customer OTHER checking out of line B waited 340 seconds.
8:38:38pm: Customer MINORJERK checking out of line C waited 2518 seconds.
9:44:40pm: Customer JERKB checking out of line B waited 6282 seconds.
10:19:18pm: Customer JERKA checking out of line C waited 8361 seconds.
11:59:58pm: Customer JERKC checking out of line C waited 14399 seconds.
- Tags:
| Project Bids |
| Programmer | Bid |
Delivery Time | Time of Bid | Rating | |
| eadweald | $30 | 2 days | 3/1/2009 at 0:41 EST | (7 reviews) |
|
| i am confident that i can do this.. good to go.. god bless.. | |||||
| theonejb | $30 | 2 days | 2/28/2009 at 6:36 EST | (No Feedback Yet) | |
| Please check PM. Thank you. | |||||
| shubhabratakarmakar | $30 | 3 days | 3/1/2009 at 6:31 EST | (No Feedback Yet) | |
| I am confident of doing this project. | |||||
| mokhtarkhorshid | $40 | 2 days | 2/27/2009 at 17:51 EST | (No Feedback Yet) | |
| I am an expert algorithm designer, building tiny programs like yours is a nice practice between projects. Your project will probably only take a few hours, but I will start it once I'm notified that you accepted my bid. Do you need it in pure C language, or would C++ be acceptable as well? If it is, the resulting code will be more compact and elegant. | |||||
| chetanjags | $45 | 1 day | 2/26/2009 at 15:26 EST | (19 reviews) |
|
| I can do this job for you plz check pmb | |||||
| bestperfect | $50 | 2 days | 2/26/2009 at 23:26 EST | (No Feedback Yet) | |
| Ready to do this project Refer PMB | |||||
| vj4u | $50 | 2 days | 2/27/2009 at 9:05 EST | (No Feedback Yet) | |
| Hi I am a computer engineer with a strong command on C/ C++. So don't worry and please let me do the job. | |||||
| codecreater |
$50 | 3 days | 2/26/2009 at 12:14 EST | (99 reviews) |
|
| can be done | |||||
| raghsund | $50 | 3 days | 2/27/2009 at 21:53 EST | (No Feedback Yet) | |
| I can perfectly do this job for you | |||||
| terryconsult | $55 | 2 days | 2/27/2009 at 5:24 EST | (12 reviews) |
|
| Kindly check PMB. | |||||
| embcoder | $100 | 1 day | 2/26/2009 at 19:13 EST | (4 reviews) |
|
| I can do it... | |||||
| maysam |
$200 | 1 day | 3/1/2009 at 15:54 EST | (148 reviews) |
|
| Quality work | |||||






