Coder Social home page Coder Social logo

car_rental's Introduction

Attached are 3 classes used for making a car rental program. Rentals of Cars are added to a Driver and a text statement is generated, which has the details of the Rentals, the amount owed, and earned bonus points.

Sample usage:

saloon1 = Car.new('Audi A3', Car::SALOON)
suv1 = Car.new('BMW X1', Car::SUV)
driver = Driver.new('Bill Simpson')
driver.add_rental(Rental.new(suv1, 2))  # rent this SUV for 2 days
driver.add_rental(Rental.new(saloon1, 2))
statement = driver.statement

Sample output:

Car rental record for Bill Simpson
BMW X1,60
Audi A3,20
Amount owed is €80
Earned bonus points: 3
  1. Improve and simplify the code but don't change the output of the statement.
  2. Add a new method (json_statement) to Driver which gives you back the statement in JSON format. You can choose the structure of the JSON.
  3. Create a rake task that runs your tests, and add a Gemfile to the project.

Please send your code submission in a zip file. There's no need for git repositories.

We're looking for demonstrated knowledge of:

  • Testing
  • General good coding practices e.g. separation of concerns, DRY
  • Ruby idioms
  • Attention to detail

What we don't need

  • Rails projects
  • Over engineered solutions with service layers and cloud storage
  • Scaling concerns

car_rental's People

Contributors

duckworthj39 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.