{"action":"created","comment":{"url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/comments/40017925","id":40017925,"diff_hunk":"@@ -1,45 +1,42 @@\n package org.scalalabs.basic.lab01\n import scala.language.implicitConversions\n-/**\n- * The goal of this exercise is to get familiar basic OO constructs in scala\n- *\n- * Fix the code so that the unit test 'CurrencyExerciseTest' passes.\n- *\n- * In order for the tests to pass you need to do the following:\n- * \n- * Exercise 1:\n- * - Create a class Euro\n- * - Provide it with two constructor parameters: euro:Int, cents:Int\n- * - Provide the cents field with default value: 0\n- * - Provide an immutable field named: inCents that converts euro + cents into cents.\n- * - Create an object Euro with a factory method named: fromCents that creates an Euro based on cents.\n- * - Create a method named: + to the Euro class that adds another Euro\n- * - Create a method named: * to the Euro class that multiplies an Euro by an integer\n- * \n- * Exercise 2:\n- * - Create an abstract class Currency\n- * - Provide it with one constructor parameter: symbol:String\n- * - Extend the previously created Euro class from Currency\n- * - Override the toString method of Euro to represent the following String:\n- *   -> symbol + ': ' + euro + ',' + cents.  E.g: EUR 200,05\n- * - In case the cents are 0 use this representation:\n- *   -> symbol + ': ' + euro + ',--. E.g.: EUR 200,--\n- *   \n- * OPTIONAL: Exercise 3:\n- * - Mix the Ordered trait in Euro\n- * - Implement the compare method  \n- * \n- * OPTIONAL: Exercise 4:\n- * - Provide an implicit class that adds a *(euro:Euro) method to Int\n- * - Create a new currency Dollar\n- * - Provide a implicit conversion method that converts from Euro to Dollar using the \n- *   [[org.scalalabs.basic.lab01.DefaultCurrencyConverter]]\n- * \n- * OPTIONAL: Exercise 5:\n- * - Extend the conversion method from Euro to Dollar with an implicit parameter \n- *   of type [[org.scalalabs.basic.lab01.CurrencyConverter]]\n- * - Use the implicit CurrencyConverter to do the conversion. \n- */\n-class Euro {\n \n+class Euro(val euro: Int, val cents: Int = 0) extends Currency(\"EUR\") with Ordered[Euro] {\n+  \n+  def inCents: Int = euro * 100 + cents;\n+  \n+  def +(rightSide: Euro) = Euro.fromCents(inCents + rightSide.inCents)\n+  \n+  def *(multiplier: Int) = Euro.fromCents(multiplier * inCents)\n+  \n+  override def toString() = {\n+    val strCents = if (cents == 0) \"--\" else f\"$cents%02d\"\n+    f\"$symbol: $euro,$strCents\"      \n+  }\n+  \n+  override def compare(other: Euro) = inCents compare other.inCents\n+  \n+}\n+\n+object Euro {\n+  \n+  def fromCents(cents: Int): Euro = new Euro(cents / 100, cents % 100)\n+  \n+  implicit class TransformIntToEuro(val value: Int) {\n+     def *(euro: Euro): Euro = euro * value \n+  }","path":"labs/src/main/scala/org/scalalabs/basic/lab01/OOExercise.scala","position":68,"original_position":68,"commit_id":"f6334b7ad9f225164971dbfaf182c33152c6d7f9","original_commit_id":"f6334b7ad9f225164971dbfaf182c33152c6d7f9","user":{"login":"AdamCDunlap","id":1733611,"avatar_url":"https://avatars.githubusercontent.com/u/1733611?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamCDunlap","html_url":"https://github.com/AdamCDunlap","followers_url":"https://api.github.com/users/AdamCDunlap/followers","following_url":"https://api.github.com/users/AdamCDunlap/following{/other_user}","gists_url":"https://api.github.com/users/AdamCDunlap/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamCDunlap/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamCDunlap/subscriptions","organizations_url":"https://api.github.com/users/AdamCDunlap/orgs","repos_url":"https://api.github.com/users/AdamCDunlap/repos","events_url":"https://api.github.com/users/AdamCDunlap/events{/privacy}","received_events_url":"https://api.github.com/users/AdamCDunlap/received_events","type":"User","site_admin":false},"body":"This class isn't really transforming an int into a euro, it's just scaling euro by the int","created_at":"2015-09-21T19:58:42Z","updated_at":"2015-09-21T19:58:42Z","html_url":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6#discussion_r40017925","pull_request_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/comments/40017925"},"html":{"href":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6#discussion_r40017925"},"pull_request":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6","id":45515421,"html_url":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6","diff_url":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6.diff","patch_url":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6.patch","issue_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/6","number":6,"state":"open","locked":false,"title":"Dan Obermiller submission","user":{"login":"Dannnno","id":6121935,"avatar_url":"https://avatars.githubusercontent.com/u/6121935?v=3","gravatar_id":"","url":"https://api.github.com/users/Dannnno","html_url":"https://github.com/Dannnno","followers_url":"https://api.github.com/users/Dannnno/followers","following_url":"https://api.github.com/users/Dannnno/following{/other_user}","gists_url":"https://api.github.com/users/Dannnno/gists{/gist_id}","starred_url":"https://api.github.com/users/Dannnno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dannnno/subscriptions","organizations_url":"https://api.github.com/users/Dannnno/orgs","repos_url":"https://api.github.com/users/Dannnno/repos","events_url":"https://api.github.com/users/Dannnno/events{/privacy}","received_events_url":"https://api.github.com/users/Dannnno/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-09-21T05:31:42Z","updated_at":"2015-09-21T19:58:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9d297899e85bb212c449c562e233ddf1a77b6b5e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6/commits","review_comments_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6/comments","review_comment_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/6/comments","statuses_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/statuses/f6334b7ad9f225164971dbfaf182c33152c6d7f9","head":{"label":"Dannnno:master","ref":"master","sha":"f6334b7ad9f225164971dbfaf182c33152c6d7f9","user":{"login":"Dannnno","id":6121935,"avatar_url":"https://avatars.githubusercontent.com/u/6121935?v=3","gravatar_id":"","url":"https://api.github.com/users/Dannnno","html_url":"https://github.com/Dannnno","followers_url":"https://api.github.com/users/Dannnno/followers","following_url":"https://api.github.com/users/Dannnno/following{/other_user}","gists_url":"https://api.github.com/users/Dannnno/gists{/gist_id}","starred_url":"https://api.github.com/users/Dannnno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dannnno/subscriptions","organizations_url":"https://api.github.com/users/Dannnno/orgs","repos_url":"https://api.github.com/users/Dannnno/repos","events_url":"https://api.github.com/users/Dannnno/events{/privacy}","received_events_url":"https://api.github.com/users/Dannnno/received_events","type":"User","site_admin":false},"repo":{"id":42706008,"name":"practice-scala","full_name":"Dannnno/practice-scala","owner":{"login":"Dannnno","id":6121935,"avatar_url":"https://avatars.githubusercontent.com/u/6121935?v=3","gravatar_id":"","url":"https://api.github.com/users/Dannnno","html_url":"https://github.com/Dannnno","followers_url":"https://api.github.com/users/Dannnno/followers","following_url":"https://api.github.com/users/Dannnno/following{/other_user}","gists_url":"https://api.github.com/users/Dannnno/gists{/gist_id}","starred_url":"https://api.github.com/users/Dannnno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dannnno/subscriptions","organizations_url":"https://api.github.com/users/Dannnno/orgs","repos_url":"https://api.github.com/users/Dannnno/repos","events_url":"https://api.github.com/users/Dannnno/events{/privacy}","received_events_url":"https://api.github.com/users/Dannnno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Dannnno/practice-scala","description":"","fork":true,"url":"https://api.github.com/repos/Dannnno/practice-scala","forks_url":"https://api.github.com/repos/Dannnno/practice-scala/forks","keys_url":"https://api.github.com/repos/Dannnno/practice-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Dannnno/practice-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Dannnno/practice-scala/teams","hooks_url":"https://api.github.com/repos/Dannnno/practice-scala/hooks","issue_events_url":"https://api.github.com/repos/Dannnno/practice-scala/issues/events{/number}","events_url":"https://api.github.com/repos/Dannnno/practice-scala/events","assignees_url":"https://api.github.com/repos/Dannnno/practice-scala/assignees{/user}","branches_url":"https://api.github.com/repos/Dannnno/practice-scala/branches{/branch}","tags_url":"https://api.github.com/repos/Dannnno/practice-scala/tags","blobs_url":"https://api.github.com/repos/Dannnno/practice-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Dannnno/practice-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Dannnno/practice-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/Dannnno/practice-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Dannnno/practice-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/Dannnno/practice-scala/languages","stargazers_url":"https://api.github.com/repos/Dannnno/practice-scala/stargazers","contributors_url":"https://api.github.com/repos/Dannnno/practice-scala/contributors","subscribers_url":"https://api.github.com/repos/Dannnno/practice-scala/subscribers","subscription_url":"https://api.github.com/repos/Dannnno/practice-scala/subscription","commits_url":"https://api.github.com/repos/Dannnno/practice-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/Dannnno/practice-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/Dannnno/practice-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/Dannnno/practice-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/Dannnno/practice-scala/contents/{+path}","compare_url":"https://api.github.com/repos/Dannnno/practice-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Dannnno/practice-scala/merges","archive_url":"https://api.github.com/repos/Dannnno/practice-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Dannnno/practice-scala/downloads","issues_url":"https://api.github.com/repos/Dannnno/practice-scala/issues{/number}","pulls_url":"https://api.github.com/repos/Dannnno/practice-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/Dannnno/practice-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/Dannnno/practice-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Dannnno/practice-scala/labels{/name}","releases_url":"https://api.github.com/repos/Dannnno/practice-scala/releases{/id}","created_at":"2015-09-18T07:19:31Z","updated_at":"2015-09-18T07:19:33Z","pushed_at":"2015-09-21T05:30:40Z","git_url":"git://github.com/Dannnno/practice-scala.git","ssh_url":"git@github.com:Dannnno/practice-scala.git","clone_url":"https://github.com/Dannnno/practice-scala.git","svn_url":"https://github.com/Dannnno/practice-scala","homepage":null,"size":4578,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hmc-cs111-fall2015:master","ref":"master","sha":"1072f2359817a99f56ca8c798e03026c739e022f","user":{"login":"hmc-cs111-fall2015","id":12563789,"avatar_url":"https://avatars.githubusercontent.com/u/12563789?v=3","gravatar_id":"","url":"https://api.github.com/users/hmc-cs111-fall2015","html_url":"https://github.com/hmc-cs111-fall2015","followers_url":"https://api.github.com/users/hmc-cs111-fall2015/followers","following_url":"https://api.github.com/users/hmc-cs111-fall2015/following{/other_user}","gists_url":"https://api.github.com/users/hmc-cs111-fall2015/gists{/gist_id}","starred_url":"https://api.github.com/users/hmc-cs111-fall2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmc-cs111-fall2015/subscriptions","organizations_url":"https://api.github.com/users/hmc-cs111-fall2015/orgs","repos_url":"https://api.github.com/users/hmc-cs111-fall2015/repos","events_url":"https://api.github.com/users/hmc-cs111-fall2015/events{/privacy}","received_events_url":"https://api.github.com/users/hmc-cs111-fall2015/received_events","type":"Organization","site_admin":false},"repo":{"id":42567697,"name":"practice-scala","full_name":"hmc-cs111-fall2015/practice-scala","owner":{"login":"hmc-cs111-fall2015","id":12563789,"avatar_url":"https://avatars.githubusercontent.com/u/12563789?v=3","gravatar_id":"","url":"https://api.github.com/users/hmc-cs111-fall2015","html_url":"https://github.com/hmc-cs111-fall2015","followers_url":"https://api.github.com/users/hmc-cs111-fall2015/followers","following_url":"https://api.github.com/users/hmc-cs111-fall2015/following{/other_user}","gists_url":"https://api.github.com/users/hmc-cs111-fall2015/gists{/gist_id}","starred_url":"https://api.github.com/users/hmc-cs111-fall2015/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmc-cs111-fall2015/subscriptions","organizations_url":"https://api.github.com/users/hmc-cs111-fall2015/orgs","repos_url":"https://api.github.com/users/hmc-cs111-fall2015/repos","events_url":"https://api.github.com/users/hmc-cs111-fall2015/events{/privacy}","received_events_url":"https://api.github.com/users/hmc-cs111-fall2015/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hmc-cs111-fall2015/practice-scala","description":"","fork":true,"url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala","forks_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/forks","keys_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/teams","hooks_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/hooks","issue_events_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/events{/number}","events_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/events","assignees_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/assignees{/user}","branches_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/branches{/branch}","tags_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/tags","blobs_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/languages","stargazers_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/stargazers","contributors_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/contributors","subscribers_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/subscribers","subscription_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/subscription","commits_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/contents/{+path}","compare_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/merges","archive_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/downloads","issues_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues{/number}","pulls_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/labels{/name}","releases_url":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/releases{/id}","created_at":"2015-09-16T05:58:43Z","updated_at":"2015-09-16T05:58:45Z","pushed_at":"2015-09-21T09:42:53Z","git_url":"git://github.com/hmc-cs111-fall2015/practice-scala.git","ssh_url":"git@github.com:hmc-cs111-fall2015/practice-scala.git","clone_url":"https://github.com/hmc-cs111-fall2015/practice-scala.git","svn_url":"https://github.com/hmc-cs111-fall2015/practice-scala","homepage":null,"size":5227,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":12,"forks":12,"open_issues":12,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6"},"html":{"href":"https://github.com/hmc-cs111-fall2015/practice-scala/pull/6"},"issue":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/6"},"comments":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/hmc-cs111-fall2015/practice-scala/statuses/f6334b7ad9f225164971dbfaf182c33152c6d7f9"}}}}