{"id":15472980,"url":"https://github.com/hackvan/cash-register","last_synced_at":"2026-06-09T21:31:47.496Z","repository":{"id":145341509,"uuid":"140043983","full_name":"hackvan/cash-register","owner":"hackvan","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-07T01:44:45.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T22:26:01.728Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-07T01:44:30.000Z","updated_at":"2018-07-07T01:44:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"5b06be2d-d61e-4a3f-b3b5-bbc193d58455","html_url":"https://github.com/hackvan/cash-register","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"686fd15fc123240fcd257e78fa61daaab321dc3a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hackvan/cash-register","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2Fcash-register","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2Fcash-register/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2Fcash-register/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2Fcash-register/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackvan","download_url":"https://codeload.github.com/hackvan/cash-register/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackvan%2Fcash-register/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34127343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T02:42:01.277Z","updated_at":"2026-06-09T21:31:47.478Z","avatar_url":"https://github.com/hackvan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Object Oriented Cash Register\n\n## Objectives\n\n1. Build a class with instance methods. \n2. Call instance methods inside of other instance methods. \n3. Use instance methods to track information pertinent to an instance of a class. \n\n## Description\n\nWe're going to create an Object Oriented Cash Register that can: \n* Add items of varying quantities and prices\n* Calculate discounts\n* Keep track of what's been added to it\n* Void the last transaction\n\n## Instructions\n\n**This is a test-driven lab!** You will need to read the spec file and the test output very carefully to solve this one. \n\n**Hint #1:** Keep in mind that to call an instance method *inside* another instance method, we use the `self` keyword to refer to the instance on which we are operating. For example:\n\n```ruby\nclass Person\n  \n  attr_accessor :age\n\n  def initialize(age)\n    @age = 0\n  end\n\n  def birthday\n    self.age += 1\n  end\nend\n```\n\nFollow along with the specs in `spec/cash_register_spec.rb`. Reading along with what the tests are looking for can be really helpful!\n\nTake it one step at a time!\n\n**Hint #2:** The `apply_discount` requires some knowledge about working with an Integer versus a Float in Ruby. Note that `100.class` returns Integer while `100.0.class` returns Float.  Ruby provides methods for changing an object of type Integer to a Float and vice versa. \n\n**Hint #3:** The `void_last_transaction` method will remove the last transaction from the total. You'll need to make an additional attribute accessor and keep track of that last transaction amount somehow. In what method of the class are you working with an individual item?\n\n\u003cp data-visibility='hidden'\u003eView \u003ca href='https://learn.co/lessons/oo-cash-register' title='Object Oriented Cash Register'\u003eObject Oriented Cash Register\u003c/a\u003e on Learn.co and start learning to code for free.\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackvan%2Fcash-register","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackvan%2Fcash-register","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackvan%2Fcash-register/lists"}