Giter Club home page Giter Club logo

practice-relationships-restaurants's Introduction

practice-relationships-restaurants

Deliverables

Initializers, Readers, and Writers

Customer

  • Customer __init__(self, first_name, last_name)
    • Customer should be initialized with a first and last name, both strings
  • Customer get_first_name()
    • returns the customer's first name
  • Customer get_last_name()
    • returns the customer's last name
  • Customer full_name()
    • returns the full name of the customer

Restaurant

  • Restaurant __init__(self, name)
    • Restaurants should be initialized with a name (string)
  • Restaurant get_name()
    • returns the restaurant's name

Review

  • Review __init__(self, customer, restaurant, rating)
    • Reviews should be initialized with a customer (Customer), restaurant (Restaurant), and a rating (int)
  • Review get_rating()
    • returns the rating for a restaurant

Object Relationship Methods

Customer

  • Customer get_reviews()
    • returns the list of Review objects associated with the Customer instance
  • Customer add_review(restaurant, rating)
    • creates a new Review objects with the given rating and adds it to both the Customer instance and the Restaurant object

Restaurant

  • Restaurant get_reviews()
    • returns the list of Review objects associated with the Restaurant instance

Review

  • Review get_restaurant()
    • returns the Restaurant object associated with the Review instance
  • Review get_customer()
    • returns the Customer object associated with the Review instance

Aggregate and Association Methods

Customer

  • Customer review_count()
    • returns the total number of reviews associated with the Customer instance

Restaurant

  • Restaurant average_rating()
    • returns the average rating for the Restaurant instance
    • HINT: can calculate the average by adding up all the ratings and diviging by the total number of ratings

practice-relationships-restaurants's People

Contributors

bencavins avatar sallykhazaal 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.