Coder Social home page Coder Social logo

market_st_apartments's Introduction

Market Street Apartments

Preparation

  1. Fork this repository.
  2. Clone your new repository to your local machine.
  3. Run bundle from the command line.
  4. Run rake from the command line.

Tasks

Add code to the Apartment and Building classes to support the interaction patterns described below.

Use tests to drive your development.

Iteration 1: Creating Apartments

In this repository we have an existing Apartment class. We're going to add to that class so that it can hold basic information about an apartment. Add to the existing Apartment class so that it supports the following interaction pattern:

> require './lib/apartment'
# => true

> a1 = Apartment.new({number: 1, monthly_rent: 800, bathrooms: 1, bedrooms: 1})
# => #<Apartment:0x007f84b40379e8 ...>

> a1.number
# => 1

> a1.monthly_rent
# => 800

> a1.bathrooms
# => 1

> a1.bedrooms
# => 1

Iteration 2: Adding Renters

Continue to add to apartments to make it so that an apartment can have a renter consistent with the interaction pattern below.

> require './lib/apartment'
# => true

> a1 = Apartment.new({number: 1, monthly_rent: 800, bathrooms: 1, bedrooms: 1})
# => #<Apartment:0x007f84b40379e8 ...>

> a1.renter
# => nil

> require './lib/renter'
# => true

> joe = Renter.new("Joe")
# => #<Renter:0x007f84b221d188 ...>

> a1.add_renter(joe)
> a1.renter
# => #<Renter:0x007f84b221d188 ...>

Iteration 3: Adding a Building

Create a Building class that allows for the following interaction pattern.

> require './lib/building'
# => true

> building = Building.new
# => #<Building:0x007f84b21e4dd8 ...>

> building.units
# => []

> a1 = Apartment.new({number: 1, monthly_rent: 650, bedroom: 1, bathroom: 1})
# => #<Apartment:0x007f84b209c408 ...>

> building.add_unit(a1)
> building.units
# => [#<Apartment:0x007f84b209c408 ...>]

> building.units.count
# => 1

> a2 = Apartment.new({number: 1, monthly_rent: 750, be    drooms: 0, bathrooms: 1})
# => #<Apartment:0x007f84b204f720 ...>

> building.add_unit(a2)
# => [#<Apartment:0x007f84b209c408 ...>, #<Apartment:0x007f84b204f720 ...>]

> building.average_rent
# => 700

> building.total_annual_rent
# => 16800

> building.occupancy
# => 0.0

> joe = Renter.new("Joe")
# => #<Renter:0x007f84b40168b0 @name="Joe">

> a1.add_renter(joe)
> building.occupancy
# => 50.0

market_st_apartments's People

Contributors

s-espinosa 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.