Giter Site home page Giter Site logo

wdi_1_ruby_lab_apartments's Introduction

Ruby Comprehensive Lab

In this lab we'll be writing a collection of Ruby classes for a real estate app to manage apartments. Use the same approach as you did for the car lot assignment: You are not writing the actual higher-level app itself, but you should have test files that verify the behavior and interactions of your classes.

Classes

Building

  • has an address
  • has many apartments
  • the list of apartments should not be modified directly (bonus: actually prevent it from being modified directly)
  • has a method to add an apartment
  • has a method to remove a specific apartment by its number, which raises an error if the number is not found or the apartment currently has any tenants (bonus: allow overriding this constraint)
  • has a total square footage, calculated from all apartments
  • has a total monthly revenue, calculated from all apartment rents
  • has a list of tenants, pulled from the tenant lists of all apartments
  • has a method to retrieve all apartments grouped by credit rating (bonus: sort the groups by credit score)

Apartment

  • has a number, rent, square footage, number of bedrooms, and number of bathrooms
  • has many tenants
  • the list of tenants should not be modified directly (bonus: actually prevent it from being modified directly)
  • has a method to add a tenant that raises an error if the tenant has a "bad" credit rating, or if the new tenant count would go over the number of bedrooms
  • has a method to remove a specific tenant either by object reference or by name (bonus: do this without checking classes), which raises an error if the tenant is not found
  • has a method that removes all tenants
  • has an average credit score, calculated from all tenants
  • has a credit rating, calculated from the average credit score using the logic below

Tenant

  • has a name, age, and credit score
  • has a credit rating, calculated from the credit score as follows:
    • 760 or higher is "excellent"
    • 725 or higher is "great"
    • 660 or higher is "good"
    • 560 or higher is "mediocre"
    • anything lower is "bad"

#raise "herpaderp here's my error"

wdi_1_ruby_lab_apartments's People

Contributors

grantovich avatar

Watchers

James Cloos avatar Nick Novak 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.