Timeline for Building shape based on user input
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2014 at 17:31 | comment | added | Flambino | @user72364 You could try something like the vehicle example I used in my answer, and make a little race where each vehicle type has a given speed. User inputs a number of minutes, and the program prints how far each vehicle got in that time. While the speed * time calculation is common for all vehicles, some have extra concerns: A plane needs to taxi before take-off, taking X minutes; a car will run out of gas after X minutes and needs to refuel (which takes some time); a ship is just slow but steady. So while they're all vehicles, they're still qualitatively different. | |
Apr 12, 2014 at 17:25 | comment | added | Flambino | @user72364 No prob. I can certainly appreciate the wish to use inheritance and so forth, however, I'd pick a different task to really have a chance to do so. Although Uri's answer makes good use of classes, the task is still so simple that it may not be the best case-study for object-oriented design. (cont'd) | |
Apr 12, 2014 at 6:51 | comment | added | user72364 | Thanks, I definitely knew everything was written really badly, just started with Ruby a day or so ago, coming from casually playing around with C in the past. Appreciate the long and detailed answer. I knew I didn't have to use classes here either, I set the challenge arbitrarily to see if I could figure out how they work. The weird parts in the code that you mentioned are there because I was having issues getting the classes to talk with each other without using inheritance, and probably forgot to delete some parts later. Anyway, cheers for the response. | |
Apr 12, 2014 at 6:41 | vote | accept | user72364 | ||
Apr 12, 2014 at 0:40 | history | edited | Flambino | CC BY-SA 3.0 |
added 661 characters in body
|
Apr 11, 2014 at 21:19 | history | edited | Flambino | CC BY-SA 3.0 |
deleted 9 characters in body
|
Apr 11, 2014 at 21:05 | history | edited | Flambino | CC BY-SA 3.0 |
spelling etc.
|
Apr 11, 2014 at 20:57 | history | edited | Flambino | CC BY-SA 3.0 |
edited body
|
Apr 11, 2014 at 20:57 | comment | added | Flambino | @UriAgassi Derp, yep, editing | |
Apr 11, 2014 at 20:13 | comment | added | Uri Agassi |
send accepts string as well
|
|
Apr 11, 2014 at 19:42 | history | edited | Flambino | CC BY-SA 3.0 |
apologies for swearing :P; added 149 characters in body
|
Apr 11, 2014 at 18:49 | history | answered | Flambino | CC BY-SA 3.0 |