{"id":5336,"date":"2024-01-17T17:27:52","date_gmt":"2024-01-17T17:27:52","guid":{"rendered":"https:\/\/danielschlegel.org\/wp\/?page_id=5336"},"modified":"2024-01-22T14:24:41","modified_gmt":"2024-01-22T14:24:41","slug":"assignment-1","status":"publish","type":"page","link":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/","title":{"rendered":"Assignment 1"},"content":{"rendered":"\n<p>This is a light and easy introduction into the project. Remember to read the&nbsp;<a href=\"http:\/\/danielschlegel.org\/files\/CSC241_Sp24\/csc241project.pdf\" class=\"ek-link\">complete project description<\/a>&nbsp;in order to understand the general context and for further details. You can <a href=\"http:\/\/danielschlegel.org\/files\/CSC241_Sp24\/CastleAdventure-1.0.jar\" class=\"ek-link\">download a jar file<\/a>&nbsp;(and required <a href=\"http:\/\/danielschlegel.org\/files\/CSC241_Sp24\/input_s24.xml\" class=\"ek-link\">sample input file<\/a>) for a project which meets the requirements of the project description but will not follow the same implementation as we will use in this course. Use IntelliJ to <a href=\"https:\/\/www.jetbrains.com\/help\/idea\/maven-support.html\" class=\"ek-link\">create a Maven project<\/a> and <a href=\"https:\/\/errorprone.info\/docs\/installation\" class=\"ek-link\">install ErrorProne<\/a>. <\/p>\n\n\n\n<p>In this first assignment you will create two classes, <tt>Room<\/tt> and <tt>Guard<\/tt>, in an appropriate package that have the following properties:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A <tt>Room<\/tt> can contain some number of <tt>Guard<\/tt>s, stored in an <tt>ArrayList<\/tt> (be sure to store the <tt>Guard<\/tt> itself, not a <tt>String<\/tt> or some other representation of it!);<\/li>\n\n\n\n<li>Every <tt>Guard<\/tt> must know about its <tt>Room<\/tt> (i.e., it needs to have a <tt>Room<\/tt> reference);<\/li>\n\n\n\n<li>Every <tt>Room<\/tt> and every <tt>Guard<\/tt> must have a name and description;<\/li>\n\n\n\n<li><tt>Room<\/tt> has a <tt>public String toString()<\/tt> method that returns the name of the <tt>Room<\/tt>, its description and the names of all <tt>Guard<\/tt>s in the <tt>Room<\/tt>. (hint: <tt>Room<\/tt>&#8216;s <tt>toString()<\/tt> method should call each <tt>Guard<\/tt>&#8216;s <tt>toString()<\/tt> method);<\/li>\n\n\n\n<li>The <tt>Room<\/tt> class should have a public constructor that takes two <tt>String<\/tt>s (the name of the <tt>Room<\/tt>, and the description of the <tt>Room<\/tt>), and a <tt>public void addGuard(Guard g)<\/tt> method that adds a <tt>Guard<\/tt> to the <tt>Room<\/tt>. Be sure to think about what needs to change about the <tt>Guard<\/tt> being assigned to the <tt>Room<\/tt>, and the <tt>Room<\/tt> it is being assigned to;<\/li>\n\n\n\n<li>The <tt>Guard<\/tt>  class should have a public constructor that takes two <tt>String<\/tt>s (the name of the <tt>Guard<\/tt>, and the description of the <tt>Guard<\/tt> ).<\/li>\n\n\n\n<li>The <tt>Guard<\/tt>  class should have a <tt>public String inspectString()<\/tt> method which returns a <tt>String<\/tt> containing the name and description of the <tt>Guard<\/tt>.<\/li>\n<\/ul>\n\n\n\n<p>In this assignment you may not use any static methods or fields &#8211; we will need the ability to have more than one <tt>Room<\/tt> and <tt>Guard<\/tt> as the project moves forward! Remember to use good practices. For example, don&#8217;t access fields directly from other classes, use getter\/setter methods (i.e., referencers).<\/p>\n\n\n\n<p>Create a third class (call it <tt>Main<\/tt>) which contains a <tt>main<\/tt> method implementing test cases for the above criteria. Be sure it contains tests for the &#8220;hard&#8221; cases, e.g., testing <tt>Room<\/tt>&#8216;s <tt>toString<\/tt> where a <tt>Room<\/tt> contains more than one <tt>Guard<\/tt>. Be sure you are happy with your output and that it looks nice &#8211; you won&#8217;t have to think about prettying it up later on!<\/p>\n\n\n\n<p>You will submit your assignment via Brightspace. To submit, zip your entire project directory (the top-level folder in the zip should be the one which contains src, target, etc.) I will be using my own driver class which tests various aspects of this assignment, so <strong>m<\/strong><b>ake sure your public methods\/fields\/classes are named exactly as described above<\/b>. My driver will use Maven and ErrorProne, so <span style=\"text-decoration: underline;\" class=\"ek-underline\">be sure your project does not have any ErrorProne errors or warnings.<\/span> If you have a warning you think is actually OK, leave a note in the Brightspace submission about it and I&#8217;ll give some feedback.<\/p>\n","protected":false},"excerpt":{"rendered":"<p class=\"lead\">This is a light and easy introduction into the project. Remember to read the&nbsp;complete project description&nbsp;in order to understand the general context and for further details. You can download a jar file&nbsp;(and required sample input file) for a project which meets the requirements of the project description but will not follow the same implementation as we will use in this&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"btn btn-warning\" href=\"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":5323,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":2,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"class_list":["post-5336","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Assignment 1 - Daniel R. Schlegel<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Assignment 1 - Daniel R. Schlegel\" \/>\n<meta property=\"og:description\" content=\"This is a light and easy introduction into the project. Remember to read the&nbsp;complete project description&nbsp;in order to understand the general context and for further details. You can download a jar file&nbsp;(and required sample input file) for a project which meets the requirements of the project description but will not follow the same implementation as we will use in this&hellip;Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/\" \/>\n<meta property=\"og:site_name\" content=\"Daniel R. Schlegel\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T14:24:41+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/assignment-1\\\/\",\"url\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/assignment-1\\\/\",\"name\":\"Assignment 1 - Daniel R. Schlegel\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/#website\"},\"datePublished\":\"2024-01-17T17:27:52+00:00\",\"dateModified\":\"2024-01-22T14:24:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/assignment-1\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/assignment-1\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/assignment-1\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Teaching\",\"item\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"CSC241 &#8211; Spring 2024\",\"item\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/teaching\\\/csc241-spring-2024\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Assignment 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/#website\",\"url\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/\",\"name\":\"Daniel R. Schlegel\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/danielschlegel.org\\\/wp\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Assignment 1 - Daniel R. Schlegel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/","og_locale":"en_US","og_type":"article","og_title":"Assignment 1 - Daniel R. Schlegel","og_description":"This is a light and easy introduction into the project. Remember to read the&nbsp;complete project description&nbsp;in order to understand the general context and for further details. You can download a jar file&nbsp;(and required sample input file) for a project which meets the requirements of the project description but will not follow the same implementation as we will use in this&hellip;Read more","og_url":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/","og_site_name":"Daniel R. Schlegel","article_modified_time":"2024-01-22T14:24:41+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/","url":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/","name":"Assignment 1 - Daniel R. Schlegel","isPartOf":{"@id":"https:\/\/danielschlegel.org\/wp\/#website"},"datePublished":"2024-01-17T17:27:52+00:00","dateModified":"2024-01-22T14:24:41+00:00","breadcrumb":{"@id":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/assignment-1\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/danielschlegel.org\/wp\/"},{"@type":"ListItem","position":2,"name":"Teaching","item":"https:\/\/danielschlegel.org\/wp\/teaching\/"},{"@type":"ListItem","position":3,"name":"CSC241 &#8211; Spring 2024","item":"https:\/\/danielschlegel.org\/wp\/teaching\/csc241-spring-2024\/"},{"@type":"ListItem","position":4,"name":"Assignment 1"}]},{"@type":"WebSite","@id":"https:\/\/danielschlegel.org\/wp\/#website","url":"https:\/\/danielschlegel.org\/wp\/","name":"Daniel R. Schlegel","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/danielschlegel.org\/wp\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/P83Tb6-1o4","_links":{"self":[{"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/pages\/5336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/comments?post=5336"}],"version-history":[{"count":10,"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/pages\/5336\/revisions"}],"predecessor-version":[{"id":5368,"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/pages\/5336\/revisions\/5368"}],"up":[{"embeddable":true,"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/pages\/5323"}],"wp:attachment":[{"href":"https:\/\/danielschlegel.org\/wp\/wp-json\/wp\/v2\/media?parent=5336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}