Thread: Car wash simulation with queues

  1. #1
    Registered User
    Join Date
    Apr 2011

    Car wash simulation with queues

    Having difficulty with understanding how to code the rest of this program. Simulation Problem:

    You own a car wash business and want to analyze customer service information. The car wash opens at 8:00am. Customers drive up to a ticket dispenser where they choose option 1 for a wash only or option 2 for a wash and wax. The customer receives a car wash ticket which has the time in hours and minutes and the option number (1 or 2). The customer drives through the car wash once it is open and not busy. The time for option 1 is 10 minutes; the time for option 2 is 14 minutes.

    suggested pseudocode:

    Build the customer queue

    Print heading

    While (customer queue is not empty)

    Get a customer item from the queue

    Determine the wash time

    Determine the start time for this customer car

    Determine the finish time for this customer car

    Determine the wait time for this customer car

    Print the information for this customer

    Calculate and print the average wait time

    Here's what i have so far

    #include "linkedQueue.h"
    using namespace std;
    struct TicketInfo
           int stampHour;
           int stampMinute;
           int WashOption;
    int main()
     ifstream FileIn;"lab7.dat");
     linkedQueueType<int> TicketQueue;
     TicketInfo Customer;
       FileIn >> Customer.stampHour;
       FileIn >> Customer.stampMinute;
       FileIn >> Customer.WashOption;
     cout << "Customer #  " << "Ticket Time  " << "Option  " << "Wash Time  "<< 
     "Start Time  " << "Finish Time  " << "Wait Time\n";
    return 0;
    so I have built the queue, but stuck as to how to get a customer item from the queue and determine the wash and start times. Ive been reading through my textbooks for any references but could not find any. The functions that i need are left as an exercise in the book so no help there lol. I know i need the while loop which is empty at the moment. If anyone could offer any tips or suggestions, it will be greatly appreciated

  2. #2
    Registered User
    Join Date
    May 2011
    Around 8.3 light-minutes from the Sun
    Your queue needs to be based off of your customer list, e.g. your ticket info. You essentially need to make a linked list here of your customers here (your stuct), iterate through the list, then based on wash option you need to calculate stop time. The start time would be based on the last customer's stop time, if there is a wait. I think you need to refresh on Linked Lists.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. queues
    By ashrrey in forum C Programming
    Replies: 3
    Last Post: 11-21-2010, 07:58 AM
  2. How do you wash your electric kettle?
    By Mario F. in forum General Discussions
    Replies: 13
    Last Post: 11-07-2009, 10:12 AM
  3. queues
    By rebelfirst in forum C++ Programming
    Replies: 9
    Last Post: 12-02-2007, 05:33 AM
  4. help with queues
    By Raideen in forum C Programming
    Replies: 2
    Last Post: 07-24-2002, 10:56 PM
  5. help with queues
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 05-21-2002, 09:09 PM