Skip to content

Latest commit

 

History

History

4_PezDispenser_solo_challenge

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Week 6 Home

U2.W6: Create a PezDispenser Class from User Stories

SOLO CHALLENGE OPTION 1

Learning Objectives

  • Implement a basic Ruby class and identify when to use instance variables
  • Translate a user story into driver code and solutions
  • Translate driver test code into a class structure using object-oriented design

Background

In this challenge, you will translate user stories into an Ruby object (using a class). If you aren't sure what a user story is, use the power of google to do some research. Also make sure to practice using your new assert knowledge!

Directions

  1. Review the User Stories:
  • As a pez user, I'd like to be able to "create" a new pez dispenser with a group of flavors that represent pez so it's easy to start with a full pez dispenser.
  • As a pez user, I'd like to be able to easily count the number of pez remaining in a dispenser so I can know how many are left.
  • As a pez user, I'd like to be able to take a pez from the dispenser so I can eat it.
  • As a pez user, I'd like to be able to add a pez to the dispenser so I can save a flavor for later.
  • As a pez user, I'd like to be able to see all the flavors inside the dispenser so I know the order of the flavors coming up.
  1. Review the Driver Code (These aren't expectations) Add assert statements (remember to define the assert method!) to make sure it's working properly.
  2. We definitely know we have a PezDispenser class, but what are it's innards? What are PezDispenser's attribute(s) and method(s)? Take a moment to list out all the methods asPseudocode, and show the input and output. It's good to be clear when there isn't an input or output!
  3. Translate your pseudocode into your Initial Solution Make sure your test code still works and satisfies the expected output.
  4. Refactor your initial solution.
  5. Reflect
  6. Sync your changes (push your solution) to Github
  7. Review