Ruby Practicum - DMV Scheduling

                                                       

Overview

For this activity you will implement a Ruby class and its methods used by the Department of Motor Vehicles (DMV) to schedule service for customers. When customers arrive at the DMV they are given a priority and a ticket number. The priority, from highest to lowest, is a letter 'A', 'B', or 'C'. The ticket numbers are generated sequentially starting at 1.

Customers are put at the tail end of a list associated with their priority; in our case, there is a Hashmap where the line ( 'A', 'B', or 'C') is the key and the value is an array which contatins the customer ticket numbers.

Setup

  1. Create a directory named exactly DMV at the top level of your directory.

  2. Download the file dmv.zip into this directory, extract all the files, and remove the downloaded dmv.zip.

  3. You should see the following files in the directory; if you do not, immediately ask for help from your instructor.

    dmv_schedule.rb and test_dmv_schedule.rb
  4. Run the following command:

    > ruby test_dmv_schedule.rb

  5. 17 unit tests will be executed, and most will fail. However, if you see the following summary on the last line:

    17 tests, 17 assertions, 16 failures, 0 errors, 0 skips

    then you have successfully downloaded and extracted the files.

    At this point you should add, commit, and push these files so that you are guaranteed to receive some credit!

  6. Skeleton method implementations (which you are to complete) are in dmv_schedule.rb; each method has a preceding comment stating what the method does. The unit tests for the module are in test_dmv_schedule.rb

  7. Methods exist to:

  8. Suggested order of implementation (you may select any order that makes sense to you):

    initialize
    get_line
    customer_count
    customer_count_all
    next_ticket
    new_customer
    serve_customer
    serve_highest_priority_customer

  9. Once you have completed a function and have a program that (a) compiles without error and (b) successfully executes the tests, we strongly suggest that you add, commit, and push what you have. 
  10. DO NOT PUSH ANY CODE THAT DOES NOT COMPILE OR THAT TERMINATES ABNORMALLY!
    See Grading below.

Grading (100 points)

  1. Programs that do not compile will be given cursory examination but cannot receive a grade over 25.
    Moral: Do not push code to your pushbox that doesn't compile.
  2. Programs that compile but which suffer a run-time error or other abnormal termination cannot receive a grade over 50.
    Moral: Do not push code to your pushbox that compiles but terminates abnormally.
  3. There are 17 unit tests incorporating 56 assertions.

  4. Each unit test is worth 5 points for a possible total of 85 points.

    1. Points are awarded only for tests that pass.
    2. A test passes if it runs without any of its included assertions failing.
    3. Some tests pass with the skeleton simply because the default values returned happen to satisfy an assertion.
      As you add code these tests may (temporarily, we hope) fail.
  5. The remaining 15 points will be awarded for the quality of your solution:

    1. Appropriate naming of variables.
    2. Consistent formatting and indentation.
    3. Cleanliness and simplicity of code.
  6. There is a 10% penalty for naming your directory anything other than DMV or for changing the names of any of the files that are part of the distribution.

  7. For the record, if you do nothing other than add, commit, and push the skeleton code from the correct directory your grade will be 27.

Successful Run Output

>ruby test_dmv_schedule.rb
Run options:

# Running tests:

.................

Finished tests in 0.010404s, 1633.9750 tests/s, 5382.5059 assertions/s.

17 tests, 56 assertions, 0 failures, 0 errors, 0 skips