Skip to content

StephanMusgrave/P1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Theatre booking system A test to develop a system to check booking requests for a Theatre.

Development in progress - not yet completed

Developed by

Steve Musgrave

Technologies used

Technology Used for
Ruby 2.1.2 Programming language
Rspec Test Driven Development - unit testing
Apple Mac and OS X 10.9.4 Hardware

How to run the program:

From your terminal:

$ git clone [email protected]:StephanMusgrave/P1.git

$ cd P1

To run the unit tests:

$ rspec

Logic:

  • Obtain a booking request
  • Check that all seats are on the same row
  • Check that the number of seats is <= 5
  • Check that each seat in the booking is not already taken
  • Check that the number of any adjacent seats to the start and end of the proposed booking are != 1 (ie can be 0 or >1)
  • Check that the seat number is between 0 and 49
  • Check that the row number is betwwen 0 and 99
  • If no errors then make the booking

Project Brief:

A cinema has a theatre of 100 rows, each with 50 seats. Customers request particular seats when making a booking. Bookings are processed on a first-come, first-served basis. A booking is accepted as long as it is for five or fewer seats, all seats are adjacent and on the same row, all requested seats are available, and accepting the booking would not leave a single-seat gap (since the cinema believes nobody would book such a seat, and so loses the cinema money).

Write a system to process a text file of bookings (booking_requests) and determine the number of bookings which are rejected. To test your system, a smaller sample file (sample_booking_requests) is supplied; processing this file should yield 11 rejected requests.

The text file of bookings contains one booking per line, where a booking is of the following form: (,:,:), Rows and seats are both 0-indexed. Note the trailing comma is absent on the final line.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages