Coder Social home page Coder Social logo

apartment-oop's Introduction

Apartment Rental App

Objective: Model functionality for an apartment rental app using JavaScript object constructors, prototypes, and inheritance.

Minimum Requirements

  • Implement constructors and prototype methods for Person, Manager, Tenant, Apartment, and Unit (see starter code in those files).
  • Implement prototypal inheritance for the following:
    • Manager inherits from Person
    • Tenant inherits from Person
  • Make sure all tests are passing (to run tests, type npm test in your Terminal).

Bonus

  • Create a new file src/inherits.js and implement an inherits function:

    var inherits = function(Child, Parent) {
      Child.prototype = new Parent();
      Child.prototype.constructor = Child;
    };
    
    module.exports = inherits;

    Then require the inherits module in each file that require inheritance, and use the inherits function to DRY up your code.

  • Write more tests! You'll find some simple tests in the test sub-directory. Once you have all the tests passing, try adding a couple more for edge cases. For example:

    • What happens if you try to add a tenant to a unit that's not available?
    • What if a tenant tries to move in without any references?

Getting Started

  1. Fork this repo, and clone it into your develop folder on your local machine.

  2. Change directories into apartment-oop, and run npm install in your Terminal. This installs the testing modules (mocha and chai) locally into your project repo.

  3. Instructions for implementing each module are in their respective files, so poke around in person.js, manager.js, tenant.js, apartment.js, and unit.js. Read the comments to guide your implementation.

Testing in Node REPL

The main.js file is set up to allow you to test your models in the node REPL.

  • Open the node REPL and require('./src/main.js'):

    โžœ  node
    > var app = require('./src/main.js');
  • Create a new instance of Person:

    > var Person = app.Person;
    > var john = new Person('John Doe', '123-456-7890');
    > john.contact
    '123-456-7890'

Submission

  • As you make code changes, frequently commit and push to GitHub.
  • Once you've finished the assignment and pushed your work to GitHub, make a pull request from your fork to the original repo.

Resources

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.