/video-store-kata

This repository has the purpose to resolve video store kata in different programming languages.

Primary LanguageC++Apache License 2.0Apache-2.0

Video store kata

The idea of this kata is taken for the video store example from the book "Refactoring" of Martin Fowler

In the video store there are 3 types of movies that can be sold:

  • regular movies
  • new release movies
  • children movies

The base cost for a regular movie is 2 Eur
After the 2 day of rental an additional cost of 1.5 per day is applied.
( So the additional cost is applied from the 3rd day )

The new release movie has a cost of 3 Eur per day rented

The base cost for a children movie is 1.5 Eur
After the 3 day of rental an additional cost of 1.5 per day is applied.
( So the additional cost is applied from the 4th day )

For each video purchased the customer earns 1 frequent renter point and
if the video is a new release and is rented for more than 1 days he earns an additional frequent renter point.

We want to print a statement for the videos purchased by a customer and his frequent renter points

Example:

If the customer Fred purchase

  • The game of thrones new release video for 1 day
  • Cinderella children video for 2 days
  • Mr. Robot regular video for 1 day
  • The Hobbit regular video for 3 days

We want to print the following statement:

Rental Record for Fred
- The game of thrones 3.0
- Cinderella 1.5
- Mr. Robot 2.0
- The Hobbit 3.5

You owed 10.0
You earned 4 frequent renter points

Additional requirement:

The video store owner changed his mind and asked to have the receipt also in HTML

<!DOCTYPE html>
<html>
  <head>
    <title>Video store - statement for Fred</title>
  </head>
  <body>
    <h1>Rental Record for Fred</h1>
    <ul>
       <li>The game of thrones 3.0</li>
       <li>Cinderella	1.5</li>
       <li>Mr. Robot	2.0</li>
       <li>The Hobbit	3.5</li>
    </ul>
    <br>You owed 10.0
    <br>You earned 4 frequent renter points
  </body>
</html>