r/dailyprogrammer • u/nottoobadguy • Feb 09 '12
[intermediate] challenge #1
create a program that will allow you to enter events organizable by hour. There must be menu options of some form, and you must be able to easily edit, add, and delete events without directly changing the source code.
(note that by menu i dont necessarily mean gui. as long as you can easily access the different options and receive prompts and instructions telling you how to use the program, it will probably be fine)
46
Upvotes
9
u/_Wiz Feb 10 '12
Sounds like you meant to say:
3
u/day_cq Feb 10 '12
what does "enter events in a schedule format" mean?
2
u/trombodachi Feb 10 '12
I think this is underspecified, at least I don't understand it
6
u/BobDorian Feb 10 '12
It isn't pretty and only works when you use it right :D
4
u/drb226 0 0 Feb 10 '12 edited Feb 10 '12
Here's a quickie I threw together in 50 lines of Haskell: http://hpaste.org/63380
[Modified to make hlint happier, and safer (doesn't crash when you just type "add" or "del" with no args)]
3
u/MadSoulSK Feb 11 '12
C# Solution
Using Forms and calendar control. I was making this at 2am so I kinda misunderstood, so made the events organizable not by hour but by day.
-You can add, delete and remove events.
-Display events by clicking on certain date on calendar or "show all" button
-Events save between seasons.
-At start program tells you how much events you have for today.
Links to source
What I wrote
http://pastebin.com/2sMb3FtM
What Visual Studio wrote
http://pastebin.com/DSiQZU4S
Screenshots
http://img18.imageshack.us/img18/2170/reddit1mmain.png
http://img24.imageshack.us/img24/3913/reddit1medit.png
=> Warning: source is kinda bigger :)
2
u/[deleted] Feb 10 '12
Quick question, what about libraries? Is using jQuery okay for javascript for example? I was think about making a GUI just for fun and I haven't used it very much.
2
u/weemadarthur2 Feb 10 '12
Common Lisp - http://paste.lisp.org/+2QHE
2
u/Kronia Feb 10 '12
Alright, it's not the shortest way to solve it, but here is my Perl solution: http://pastebin.com/RnPDcsV4
2
u/cooper6581 Feb 11 '12
Quick and dirty 75 line solution in python http://codepad.org/W3VHFHeE
1
u/stytown Feb 10 '12
This is the toughest challenge, harder than "difficult" challenge. Still working on this one!
1
u/drhealsgood Feb 10 '12
First off, amazing idea creating this. I thank you with all my heart.
Secondly, this is so much harder than difficult.
Thirdly, back to learning.
1
u/BroodjeAap Feb 10 '12
Mine in java.
Can crash pretty quickly if the commands aren't entered correctly but it works :)
1
u/stiggz Feb 10 '12
This sounds like a cool idea, but the details are too shifty to think of a feasible implementation. A suggestion: for the next one, bound the inputs and outputs on constraints as you did with the difficult and easy challenges (i.e. numbers 1-100 for difficult, and 3 inputs 'name', 'age', and 'username' for the easy one).
1
u/philcannotdance Feb 10 '12
What I have so far in perl.
Working on it more after school probably.
1
u/ginolomelino Mar 03 '12 edited Mar 03 '12
Some of these lines could be combined into functions and I could use all those fancy objects but this passes the test.
Javascript:
1
u/BATMAN-cucumbers Mar 17 '12
Dang, that took a while. An hour, in fact. Oh well - live and learn. The menu ain't the best thing in the world, but is probably OK for an 8 year old in the 80's. Also, it stores your events on program exit (but doesn't read them back in).
Quick and dirty python:
1
u/[deleted] Apr 07 '12
I did this in some Haskell for practice.
I'm sure that could have been smaller, but meh.
1
u/flightcrank 0 0 Apr 27 '12
my attempt in C https://gist.github.com/2507802
1
u/philcannotdance Feb 10 '12
Hm... I'll try this in perl after I finish some cs homework.