PDA

View Full Version : I want to write a program and i dont know how to?



i.mehrzad
December 14th, 2008, 10:32 AM
I want to write a program which will solve the following.

My friends and me normally go out on tours and we never spend equal amounts of cash. There is always a case that someone will spend more than the other. The problem is when we return there is always a confusion as to who has to pay who'm how much. Therefore i thought of using my (noobish) programming skills, and write a program that will enable me to this. Sure an ambitious leap, but i myself dont know how to start.

Anyone with any opinions, which can help with this program, please!

pp.
December 14th, 2008, 10:53 AM
Use a spreadsheet.

crazyfuturamanoob
December 14th, 2008, 11:05 AM
Wait a sec, which programming language?

gjoellee
December 14th, 2008, 12:34 PM
you should learn Python, a good tutorial here: http://www.freenetpages.co.uk/hp/alan.gauld/

Jonas thomas
December 14th, 2008, 12:49 PM
I want to write a program which will solve the following.

My friends and me normally go out on tours and we never spend equal amounts of cash. There is always a case that someone will spend more than the other. The problem is when we return there is always a confusion as to who has to pay who'm how much. Therefore i thought of using my (noobish) programming skills, and write a program that will enable me to this. Sure an ambitious leap, but i myself don't know how to start.

Anyone with any opinions, which can help with this program, please!

This is me just thinking out loud here... Wouldn't it be cool to be able to keep track of what you spend individually in your cell phone and then reconcile all on the end of night/next day? I know nothing about programming cell phones.. Ah heck... If you make a million bucks err...49,717,770 Ruppee's remember who gave you the idea. Hey... if you did trend analysis you could figure out the cheap skate is and avoid him ;)

mmix
December 14th, 2008, 01:27 PM
learn to use gnu cash

http://en.wikipedia.org/wiki/GnuCash

i.mehrzad
December 14th, 2008, 02:08 PM
I intend in using Python, but nonetheless i am totally new to the language. Am learning the language at present. I have hands on experience with C but i think i have given up on that language.

Tomosaur
December 14th, 2008, 03:26 PM
I intend in using Python, but nonetheless i am totally new to the language. Am learning the language at present. I have hands on experience with C but i think i have given up on that language.

Why reinvent the wheel? A spreadsheet will do this for you and you don't need to waste your time writing a totally new program :P

Also - keep hold of your receipts and buy your own stuff separately, if possible.

mkrahmeh
December 14th, 2008, 03:43 PM
you may create a shared pocket to which everyone contributes equally..
and assign each one a fixed number of coupons to spend from...
mmmm
ok
it seems writing a program is way better :lolflag:

Jonas thomas
December 14th, 2008, 03:46 PM
Why reinvent the wheel? A spreadsheet will do this for you and you don't need to waste your time writing a totally new program :P

Also - keep hold of your receipts and buy your own stuff separately, if possible.
Back in the day when I was young and had disposable income, I'd think nothing of buying a round for my friends... The thing is my circle of friends had exactly the same idea. That was then, this is now. Boy have times changed... Luckily I still have a functioning liver.;) Either stay home and learn how to program or find a better circle of friends..

wmcbrine
December 14th, 2008, 03:55 PM
I have to ask: What exactly would this hypothetical program do?

It seems to me that the main part of the task is recording individual expenditures. Then, at the end, you add them up. Unless you have a mobile device to run your program on, you may as well write payments down in a notebook as you go. And adding them up afterwards is too simple to merit a program.

ankursethi
December 14th, 2008, 04:39 PM
If you have a mobile phone, it's worth trying to write a program for that instead so you can keep it with you at all times. Just a idea ...

(BTW, Python is available on many phones, especially on Nokia phones. You might want to Google a bit.)

jimi_hendrix
December 14th, 2008, 04:59 PM
simple...program could flow like:

input number of friends (including yourself) (and their names too if you want)

enter ammount each payed

total ammount

divide total by number of friends

subtract the devided total from the ammount each payed and print per friend

if the value is negative they owe the ammount < 0

if the value is possitive they are owed that ammount by the others

nvteighen
December 14th, 2008, 05:10 PM
If you develop this I'll use it. My friends and I had a stupid experience on a bar one day because of not having such a program... :p

pp.
December 14th, 2008, 05:24 PM
If you develop this I'll use it. My friends and I had a stupid experience on a bar one day because of not having such a program... :p

My pda does spreadsheets, so it's conceivable that some phones do that as well.

Whether you'll be able to use any software at all while having a stupid experience at a bar is an altogether different story.

Tomosaur
December 14th, 2008, 05:45 PM
Back in the day when I was young and had disposable income, I'd think nothing of buying a round for my friends... The thing is my circle of friends had exactly the same idea. That was then, this is now. Boy have times changed... Luckily I still have a functioning liver.;) Either stay home and learn how to program or find a better circle of friends..

I was a student for the last 3 years, and before that I was on minimum wage. I have been effectively penniless until this year, so it's only fairly recently I've been able to actually buy things I want and buy rounds at the bar. I like being able to 'share the wealth', so to speak - but a lot of my friends are still students (ergo - poor) so I try not to be too obvious. A lot of the time I'll just buy them a drink gratis - I know what it's like not being able to afford stuff so it's nice to be able to help your friends out. It's not like I ever really buy anything anyway (I hate shopping, I don't understand people who just go to shops to see what's there. The less time I have to spend in a shop, the better, as far as I'm concerned :P ), so I may as well spread it around if I can.

That being said, this particular problem seems like a no-brainer. Just keep track of what you spend - it's not that hard :P

i.mehrzad
December 14th, 2008, 06:10 PM
Now that everything is said and done. I want to implement a GUI to my program. I used Jimi hendrix's idea. Any recommendations on how to start. I have no clue of any GUI programming.

jimi_hendrix
December 14th, 2008, 06:39 PM
look into wxWidget and python or tkWidget (i think thats the name)...

tcl/tk is also nice but tcl is another language (though similar to bash) that is good for GUI's

nvteighen
December 14th, 2008, 06:50 PM
look into wxWidget and python or tkWidget (i think thats the name)...

tcl/tk is also nice but tcl is another language (though similar to bash) that is good for GUI's
Actually, Tcl/Tk might be an interesting and reasonable choice... It would avoid the hassle of using toolkits devoted to bigger projects (and therefore, bigger APIs) like GTK+ and Qt. wxWidgets IIRC has some layout issues in GNU/Linux (someone confirm this, please).

Anyway, all of these are cross-platform, so if your friends don't use a GNU/Linux distro, they'll be able to use it anyway! :)

Jonas thomas
December 14th, 2008, 07:00 PM
I was a student for the last 3 years, and before that I was on minimum wage. I have been effectively penniless until this year, so it's only fairly recently I've been able to actually buy things I want and buy rounds at the bar. I like being able to 'share the wealth', so to speak - but a lot of my friends are still students (ergo - poor) so I try not to be too obvious. A lot of the time I'll just buy them a drink gratis - I know what it's like not being able to afford stuff so it's nice to be able to help your friends out. It's not like I ever really buy anything anyway (I hate shopping, I don't understand people who just go to shops to see what's there. The less time I have to spend in a shop, the better, as far as I'm concerned :P ), so I may as well spread it around if I can.

That being said, this particular problem seems like a no-brainer. Just keep track of what you spend - it's not that hard :P

I'm sort of regretting my last comment. It was sort of flippant. I remember years ago I went to a ball-game with some work associates and couldn't understand why no one else was buying rounds.. I guess everyone has their own situation and I apologize if I offended anyone by my attempt trying to be funny. Please keep us posted as to what you wind up doing.

jimi_hendrix
December 14th, 2008, 07:34 PM
hellow world in tcl with tk gui:



#!/usr/bin/wish
label .lbl -text "Hello World"
pack .lbl


note i did not test this because i am not on linux but it should work...

label is the call of the function

.lbl is the label name

-TEXT is the text attribute

"Hello World" is the value we set -TEXT to put it on the window

pack .lbl puts .lbl on the screen

you can use grid instead of pack for more control but it is more complicated