This seems to sometimes cause bikeshedding. should I use sub-typing, or should I use type-classes). The second issue that I have with Scala is that sometimes it can be hard to know how to model something (e.g. If they show an interest, then I will also try and illustrate why they might want to learn a language like Scala. When it comes to my children, I will probably mainly teach them Python, because that is what their course work will be, and that is what their peers will probably be learning. If I have written a utility in Scala then they would rather rewrite it in Python than learn Scala! The final issue I seem to have with Scala is that many of my colleagues just don’t want to learn it, but they all happily learn Python. Scala is a different beast, I think that it has higher initial complexity, but is easier to write correct complex programs. My person opinion is that folks like languages like C and Python because they perceive them as being simple languages, but at the cost that it is much harder to write correct program (particularly in C). extra verbosity) and none of the benefits (e.g. I think that C illustrates nearly all of the bad points of static typing (e.g. I also completely agree that learning a dynamically typed language, or a basic imperative language (such as C) can teach lots of bad habits. Please refer to the Java tutorial page on Classes for information on class constructors and how they are used.I completely agree that the non-advanced parts of Scala are a great choice as a first CS course in schools/college. Also, the 'addObject' method accepts an Actor and two ints as arguments (not just an actor - if that is what is returned by 'newEmoticon'). And line 50 has an unknown method 'newEmoticon' being called using a concatenated String value as an argument (which I doubt you want to do). That condition is accounted for in the 'for' statement on line 46. Lint 48 of the HomeworkWorld class is not needed. I think you want to save individual Strings in each of the Emoticon objects created, not arrays of Strings. Then, lines 37 and 38 are trying to set arrays to String values. * a dot, '.', before the file name suffix on line 55 of the Emoticon class * a constructor declaration statement between the field declarations on lines 18 and 19 and the constructor code, lines 36 through 39 of the Emoticon class * a semi-colon, ' ', at the end of line 36 of the Emoticon class * The y value can be either hard coded or calculatedĪddObject(newEmoticon(image + sound)) * Determine the x value using a mathematical calculation * Note: concatinate the ".png" for images and ".wav" for the sounds * It should use the method addObject( Actor object, int x, int y) to add new Emoticons to your world. * It should loop 5 times (you can either hard code 5 or use code) Create a new world with 400x100 cells with a cell size of 1x1 pixels. * Constructor for objects of class HomeworkWorld. * DO NOT INCLUDE THE FILE SUFFIX - add that through code later * Add two instance variables that are of type String * scenarios creating images and sounds together. * Write a description of class HomeworkWorld here. * Use the method aySound( filename ) to play the sound When the mouse is click on this object, play the sound. * the 'Act' or 'Run' button gets pressed in the environment. * Act - do whatever the Emoticon wants to do. Use the method setImage( filename ) to set the image.Įmoticon emoticon = new Emoticon(image,sound) set the instance variable sound to the value passed by the corresponding parameter set the instance variable image to the value passed by the corresponding parameter * Create two instance varaibles of type String * Write a description of class Emoticon here.Create 5 different images and sounds to run. Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |