Coder Social home page Coder Social logo

grocery-store's Introduction

Grocery Store

Let's simulate a grocery store system! We want to be able to keep track of the orders that folks make, both online and physically in our grocery store.

This project will allow you to explore object-oriented design as well as a few other new topics. This is an individual, stage 1 project.

The project is due before class on Monday February 19th

Learning Goals

You should demonstrate an ability to:

  • Practice Test-Driven-Development
  • Use instance variables and methods
  • Reading from a CSV file
  • Write DRY code by reusing methods
  • Use inheritance to create a subclass

Baseline Setup

  1. Fork the project master.
  2. Clone the forked repo: $ git clone [YOUR FORKED REPO URL]
  3. cd into the dir created $ cd grocery-store
  4. Run git remote -v to verify the folder you are in corresponds to the fork you have created.
    If it is correct it will include your username If it is incorrect it will include "AdaGold" or "Ada-C8"
  5. Run gem install minitest-skip to install an extra gem for testing (more on what this actually does later).

Testing

This is our first project with real tests! Following the instructions from the TDD lecture, there are three things in our project directory:

Rakefile
lib/
specs/

Each class you write (there will only be one until wave 3) should get its own file, lib/class_name.rb. The specs for that class will be in specs/class_name_spec.rb, and you can run all specs using the rake command from your terminal.

Wave 1

Learning Goals

  • Create a class inside of a module
  • Create methods inside the class to perform actions
  • Learn how Ruby does error handling
  • Verify code correctness by testing

Testing

For Wave 1, all tests have been provided for you. For each piece of functionality that you build, you should run the tests from the command line using the rake command. To focus on only one test at a time, change all it methods to xit except for the one test you'd like to run. All tests provided should be passing at the end of your work on Wave 1.

Requirements

Create a Grocery module which will contain an Order class and any future grocery store logic.

Create an Order class which should have the following functionality:

  • A new order should be created with:
    • an ID, read-only
    • a collection of products and their cost
      • zero products is permitted
      • you can assume that there is only one of each product
  • A total method which will calculate the total cost of the order by:
    • summing up the products
    • adding a 7.5% tax
    • ensure the result is rounded to two decimal places
  • An add_product method which will take in two parameters, product name and price, and add the data to the product collection
    • It should return true if the item was successfully added and false if it was not

Optional:

Make sure to write tests for any optionals you implement!

  • Add a remove_product method to the Order class which will take in one parameter, a product name, and remove the product from the collection
    • It should return true if the item was successfully remove and false if it was not

What We Are Looking For

Check out the feedback template to see what instructors will be looking for.

grocery-store's People

Contributors

kariabancroft avatar torshimizu avatar cheezitman avatar

Watchers

James Cloos 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.