Skip to content

wf1101/grocery-store

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 Tuesday February 20th

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-CX"
  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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%