{"id":24056242,"url":"https://github.com/arjun1237/canvas-drawing-tool---assignment","last_synced_at":"2025-09-08T22:35:55.268Z","repository":{"id":110875024,"uuid":"101798889","full_name":"arjun1237/Canvas-Drawing-Tool---Assignment","owner":"arjun1237","description":"Java Assignment","archived":false,"fork":false,"pushed_at":"2018-08-04T19:11:02.000Z","size":162,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T12:13:43.539Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/arjun1237.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":"2017-08-29T19:28:42.000Z","updated_at":"2018-08-04T19:11:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"f485e7db-dd7f-455f-b8f6-3d0a2d777cf8","html_url":"https://github.com/arjun1237/Canvas-Drawing-Tool---Assignment","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arjun1237/Canvas-Drawing-Tool---Assignment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arjun1237%2FCanvas-Drawing-Tool---Assignment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arjun1237%2FCanvas-Drawing-Tool---Assignment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arjun1237%2FCanvas-Drawing-Tool---Assignment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arjun1237%2FCanvas-Drawing-Tool---Assignment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arjun1237","download_url":"https://codeload.github.com/arjun1237/Canvas-Drawing-Tool---Assignment/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arjun1237%2FCanvas-Drawing-Tool---Assignment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231417,"owners_count":25245659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"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":"2025-01-09T05:00:24.235Z","updated_at":"2025-09-08T22:35:55.247Z","avatar_url":"https://github.com/arjun1237.png","language":"Java","readme":"# Canvas-Drawing-Tool---Assignment\nJava Assignment\n\nCO882 Assignment 1 (Version 2016.11.15.01)\n\nCopyright 2016 David J. Barnes\n\nPosting of this document outside kent.ac.uk is not permitted\n\nIntroduction\n\nThis assignment is designed to assess your understanding of code quality issues, such as\nrefactoring, coupling and cohesion, as well as providing further practical experience\nworking with a substantial piece of program code.\n\nDate set: 15th November 2016\n\nDate due: 23:55 7th December 2016\n\nWeighting: 35% of the coursework mark.\n\nThe task has been broken down into two stages to guide you in its development.\n\nThe Task\n\nThe task is to adapt the scribble project from chapter 6 with the addition of a text-based\nuser interface to create drawings:\n\nhttps://www.cs.kent.ac.uk/~djb/co882/LOCAL-ONLY/assign1.zip\n\nYou are provided with the source code of three classes – Pen, Canvas and InputReader –\nbut the BlueJ editor for these classes is currently showing the Documentation view of them\nrather than the Source Code view. The Documentation view is simply the javadoc\ndocumentation for the classes that has been generated from the comments and method\nheaders that are in the source code. The idea is that it should be easy to use these\nclasses without needing to see details of the source code. You can flip the views by using\nthe drop-down menu in the top-right corner of the editor window. There should be no need\nto change the source code of any of these classes. However, if you feel that you need to\nmake changes to them then ask me whether this is acceptable or appropriate before doing\nso.\n\nYour task is to complete the code currently in the DrawingTool class so that users can\ninteractively create and manipulate shapes to create pictures. You may add any further\nclasses that you feel are necessary to fulfil the requirements and you may modify the\nexisting code of the DrawingTool class in any way that you wish.\n\nAssessment criteria\n\nThe following sections give details of the tasks that are required. In completing these,\nplease bear in mind that your work will be assessed primarily against the following criteria:\n\n• Accurate implementation of the drawing commands.\n\n• Adherence to appropriate principles of cohesion and coupling.\n\n• Appropriate use of Java and its library classes.\n\n• Appropriate detection and reporting of errors when a user uses the command\nlanguage incorrectly or inappropriately.\n\n• Good coding style: well laid out with the fields, methods and constructors properly\ndocumented. In particular, use of javadoc-style notation is a requirement and\nadherence to these will be included in the marking scheme.\n\nIf in doubt about good style, a style guide is available: http://www.bluej.org/objectsfirst/\nstyleguide.html.\n\nBackground\n\nThe idea is that users should be able to interactively create drawings manipulating a Pen\nobject on a Canvas via typing commands into the terminal window. If you create a\nDrawingTool object and then call its draw method, the following will appear in the terminal\nwindow:\n\nWelcome to the drawing tool.\n\nPen position: 0,0\n\nThe pen is up.\n\nType bye to exit.\n\n\u003e\n\nIf you type bye then the draw method will terminate. That is pretty-much all of the\nfunctionality that is currently available in the DrawingTool class. Your task will be to add\nmore as described below.\n\nHow it currently works\n\nA DrawingTool object uses an InputReader object to prompt for and read input from the\nuser in the Terminal Window. Whatever the user types at the command prompt is read by\nthe InputReader and separated into individual words – just as is done in the tech-support\nproject in chapter 6. However, in this project the words are not stored in a HashSet but\nreturned from the InputReader’s getInput method as a LinkedList of individual String\nobjects. For instance, if the user typed:\n\nmoveto 20 30\n\nthese would be returned as an ordered list containing three String objects: “moveto”, “20”\nand “30”.\n\nWhat to add\n\nYour task is to enhance the current functionality so that users can create drawings on the\ncanvas using a Pen object. Commands typed by the user will need to be turned into calls\nto methods defined in the Pen class, such as move, penUp, etc. The task has been broken\ndown into two stages but these are only for guidance.\n\nIn Stage One of the assignment you will implement a command language that will work\nwith just a single Pen. In later stages the language will be extended to allow the creation\nand manipulation of multiple pens as well as user-defined command sequences.\n\nThe drawing language – Stage One [60%]\n\nImplement the following commands to control the Pen:\n\n• up\n\nRaise the pen off the canvas so that movements do not cause drawing.\n\n• down\n\nLower the pen onto the canvas so that movements cause drawing.\n\n• move distance\n\nMove the pen the specified distance in its direction of movement. distance must be\nan integer value.\n\n• moveto x y\n\nMove to co-ordinate position x,y on the canvas. Both x and y must be integers.\n\n• turn angle\n\nChange the direction of movement by angle degrees. angle must be an integer.\n\n• turnto angle\n\nChange the direction of movement to angle degrees. angle must be an integer.\n\n• colour colour-name\n\nChange the drawing colour to be colour-name. colour-name must be one of the\nfollowing: “red”, “blue”, “yellow”, “magenta”, “green” or “black”.\n\n• help\n\nPrint an explanatory help message.\n\nValid commands must have exactly the correct number of elements. For instance:\n\nmove 30\n\nis valid, but\n\nmove 30 40\n\nis not valid. Commands that are not valid should produce an error message and there\nshould be no change to the state of the pen or the canvas.\n\nExample for Stage 1\n\nThe following example sequence of commands would draw a green square with side\nlength 20 pixels, starting at position 10,10:\n\n\nup\n\ncolour green\n\nmoveto 10 10\n\ndown\n\nturnto 0\n\nmove 20\n\nturn 90\n\nmove 20\n\nturn 90\n\nmove 20\n\nturn 90\n\nmove 20\n\nNote that the InputReader class includes methods that will help you to check for and\nconvert strings that contain integer values.\n\nThe drawing language – Stage Two [40%]\n\nExtend the command language so that multiple pens may be created and controlled. The\nfollowing additional commands must be added:\n\n• pen name\n\nCreate a new Pen that will be referred to with the given name. It is an error to\nattempt to create a pen with a name that is currently in use.\n\n• select name\n\nSelect the pen with the given name as the one to which future commands will apply.\n\nIt is an error to attempt to select a pen with a name that is not currently in use.\n\n• delete name\n\nDelete the pen with the given name. The name will no longer be in use. It is an error\nto attempt to select a pen with a name that is not currently in use. It is possible to\ncreate a new pen with a name that has previously been used but deleted.\n\nIn this version, no Pen object should be created when the DrawingTool object is created.\nAll Pen objects must be created as the result of a pen command.\n\nImmediately following the successful execution of a pen or select command, all\ncommands of the Stage 1 language apply to that pen. Other pens remain inactive until\nselected again.\n\nExample for Stage 2\n\nThe following example will draw two parallel lines using two separate pens; the upper line\nis drawn in green and the lower line in magenta:\n\npen first\n\nup\n\ncolour green\n\nmoveto 10 10\n\ndown\n\nmoveto 20 10\n\npen second\n\nup\n\ncolour magenta\n\nmoveto 20 20\n\ndown\n\nmoveto 10 20\n\nWhat to submit\n\nYou will submit a Java ZIP file of your project via a Moodle hand-in area to be provided\nshortly. In addition, a transcript of a typical user session and a screenshot of what it draws\nmust be provided to illustrate a representative sample of your program working. Use the\n“Save to file” option of the BlueJ terminal to save the transcript as a text file.\n\nPlagiarism and Duplication of Material\n\nThe work you submit must be your own. We will run checks on all submitted work in an\neffort to identify possible plagiarism, and take disciplinary action against anyone found to\nhave committed plagiarism.\n\nSome guidelines on avoiding plagiarism:\n\n• One of the most common reasons for programming plagiarism is leaving work until\nthe last minute. Avoid this by making sure that you know what you have to do (that\nis not necessarily the same as how to do it) as soon as an assessment is set. Then\ndecide what you will need to do in order to complete the assignment. This will\ntypically involve doing some background reading and programming practice. If in\ndoubt about what is required, ask a member of the course team.\n\n• Another common reason is working too closely with one or more other students on\nthe course. Do not program together with someone else, by which I mean do not\nwork together at a single PC, or side by side, typing in more or less the same code.\nBy all means discuss parts of an assignment, but do not thereby end up submitting\nthe same code.\n\n• It is not acceptable to submit code that differs only in the comments and variable\nnames, for instance. It is very easy for us to detect when this has been done and\nwe will check for it.\n\n• Never let someone else have a copy of your code, no matter how desperate they\nare. Always advise someone in this position to seek help from their class supervisor\nor lecturer. Otherwise they will never properly learn for themselves.\n\n• It is not acceptable to post assignments on sites such as Freelancer and we treat\nsuch actions as evidence of attempted plagiarism, regardless of whether or not\nwork is payed for. In addition, posting anywhere other than kent.ac.uk would be an\ninfringement of the author’s copyright.\n\nFurther advice on plagiarism and collaboration is also available at:\n\nhttp://www.cs.kent.ac.uk/teaching/student/assessment/plagiarism.local\n\nYou are reminded of the rules about plagiarism that can be found in the course Handbook.\nThese rules apply to programming assignments. We reserve the right to apply checks to\nprograms submitted for assignment in order to guard against plagiarism and to use\nprograms submitted to test and refine our plagiarism detection methods both during the\ncourse and in the future.\n\nDavid Barnes\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farjun1237%2Fcanvas-drawing-tool---assignment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farjun1237%2Fcanvas-drawing-tool---assignment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farjun1237%2Fcanvas-drawing-tool---assignment/lists"}