Skip to content

Abid-dev/cinema-tickets-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cinema-tickets-js

This was a javascript assessment project assigned by DWP. I was tasked to make working cinema ticket service.

Contents

Task Rules

  • There are 3 types of tickets i.e. Infant, Child, and Adult.

  • The ticket prices are based on the type of ticket (see table below).

  • The ticket purchaser declares how many and what type of tickets they want to buy.

  • Multiple tickets can be purchased at any given time.

  • Only a maximum of 20 tickets that can be purchased at a time.

  • Infants do not pay for a ticket and are not allocated a seat. They will be sitting on an Adult's lap.

  • Child and Infant tickets cannot be purchased without purchasing an Adult ticket.

Ticket Type Price
INFANT £0
CHILD £10
ADULT £20
  • There is an existing TicketPaymentService responsible for taking payments.

  • There is an existing SeatReservationService responsible for reserving seats.

Constraints

  • The TicketService interface CANNOT be modified. (For Java solution only)

  • The code in the thirdparty.* packages CANNOT be modified.

  • The TicketTypeRequest SHOULD be an immutable object.

Assumptions

You can assume:

  • All accounts with an id greater than zero are valid. They also have sufficient funds to pay for any no of tickets.

  • The TicketPaymentService implementation is an external provider with no defects. You do not need to worry about how the actual payment happens.

  • The payment will always go through once a payment request has been made to the TicketPaymentService.

  • The SeatReservationService implementation is an external provider with no defects. You do not need to worry about how the seat reservation algorithm works.

  • The seat will always be reserved once a reservation request has been made to the SeatReservationService.

Your Task

Provide a working implementation of a TicketService that:

  • Considers the above objective, business rules, constraints & assumptions.

  • Calculates the correct amount for the requested tickets and makes a payment request to the TicketPaymentService.

  • Calculates the correct no of seats to reserve and makes a seat reservation request to the SeatReservationService.

  • Rejects any invalid ticket purchase requests. It is up to you to identify what should be deemed as an invalid purchase request.”

Installation

git clone https://github.com/Abid-dev/cinema-tickets-js.git
cd cinema-tickets-js
npm install

To run the program locally on your browser, run the following command:

node app.js

You should be able to view and play around with it on your localhost port 3000.

Screenshot

Homepage

About

This was a javascript assessment project assigned by DWP. I was tasked to make working cinema ticket service.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors