{"id":205,"date":"2011-07-21T21:33:36","date_gmt":"2011-07-22T04:33:36","guid":{"rendered":"http:\/\/blogs.unsw.edu.au\/comp1400\/?p=205"},"modified":"2011-07-21T21:37:04","modified_gmt":"2011-07-22T04:37:04","slug":"tutorial-wk-2-getting-to-know-bluej","status":"publish","type":"post","link":"https:\/\/blogs.unsw.edu.au\/comp1400\/blog\/2011\/07\/tutorial-wk-2-getting-to-know-bluej\/","title":{"rendered":"Tutorial Wk 2 &#8211; Getting to know BlueJ"},"content":{"rendered":"<p>There are two tasks for this week&#8217;s lab:<\/p>\n<ol>\n<li>Activate your CSE account.<\/li>\n<li>Write your first program!<\/li>\n<li>Play with BlueJ<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<h2>Activate your CSE account<\/h2>\n<p>The first thing we will do in this week&#8217;s lab is activate your CSE account:<\/p>\n<ol>\n<li>Go into the banjo lab (next door to the CHI lab)<\/li>\n<li>Login as &#8216;newuser&#8217;<\/li>\n<li>Follow the prompts to activate your account.<\/li>\n<li>Write your new username and password somewhere so you don&#8217;t lose it.<\/li>\n<li>Log out.<\/li>\n<li>Log back in with your new CSE login and password (to activate your account).<\/li>\n<li>Log out again.<\/li>\n<li>Return to the Mac lab, but don&#8217;t log in yet as it will take a while for your account details to be processed.<\/li>\n<\/ol>\n<h2>Write your first program.<\/h2>\n<p>This is an exercise in breaking down a task into a sequence of simple instructions. Work in pairs. Your tutor will give each of you a small, incomplete pack of cards.<\/p>\n<ol>\n<li>Shuffle the deck.<\/li>\n<li>Go through the deck to find the smallest card.<\/li>\n<li>On a sheet of paper, write a set of instructions so that someone else can repeat the same procedure. Assume that they are very stupid and need to have ever last detail spelled out.<\/li>\n<li>Test your instructions on different size decks:\n<ul>\n<li>What if there is only 2 cards in the deck? Or only one? Or none?<\/li>\n<li>What if all the cards in the deck were the same?<\/li>\n<\/ul>\n<\/li>\n<li>Swap programs with another pair and check their code. Was it the same as yours?<\/li>\n<li>Consider: What are the <strong>objects<\/strong> in your program? What are the <strong>classes<\/strong>? What <strong>fields<\/strong> do they have? What <strong>methods<\/strong> do they provide?<\/li>\n<li>Now try writing instructions to sort the entire deck into order.<\/li>\n<\/ol>\n<h2>Experiment with BlueJ<\/h2>\n<p>Experiment with the BlueJ projects we saw in lectures.<\/p>\n<ol>\n<li>Login with your CSE login and password set up earlier<\/li>\n<li>Start BlueJ<\/li>\n<li>Select &#8216;Open Project&#8217; from the File menu and open the &#8216;shapes&#8217; project.<\/li>\n<li>Experiment with constructing objects and calling methods. Try to construct a picture out of circles, squares and triangles of different sizes and colours.<\/li>\n<li>Use the inspector to examine the objects you have created. How do the fields on a Triangle differ from those on a Circle?<\/li>\n<li>Double click on the Circle class to view its source code. Try to identify the fields and methods in the code. How much of the code can you understand?<\/li>\n<li>Open the &#8216;picture&#8217; project and have a play with the new class it provides.<\/li>\n<li>Open the source code for the Picture class and take a look at the <strong>draw()<\/strong> method. This is the code that constructs the house from shapes.<\/li>\n<li>Change some of the method parameters and compile the source. Can you make the sun blue? Can you change the position of the window?<\/li>\n<li><strong>Optional Challenge:<\/strong> Add code to the draw() method to make the sun set using the slowMoveVertical() method on the Circle class.<\/li>\n<li><strong>Optional Extra Challenge<\/strong> If you did the above challenge you probably found that the sunset happened as soon as the draw() method was called. Try creating a separate method called sunset() that does this instead.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>There are two tasks for this week&#8217;s lab: Activate your CSE account. Write your first program! Play with BlueJ<\/p>\n","protected":false},"author":80,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/users\/80"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":3,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":210,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/posts\/205\/revisions\/210"}],"wp:attachment":[{"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.unsw.edu.au\/comp1400\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}