PDA

View Full Version : java question



Free Styler
10-03-2004, 08:54 PM
ok people i really tryd to find the awnser myself but i am now stuck tothis.

We have to make a program that's calculates the area of a square.

now in a ln logic it's pretty damn easy to do in your head but im having trouble finding the good command lines to do it in java. Now basicly what i have to do is make dialogue boxs thats ask me the lenght of one side ofthe square and then awnsering in that dialogue boxs a other dialogue boxs appears and gives the awnser.

the fist part i figured out for myself .Honesly i'm suprise the teachers are even giving us these excersises,cause we have not seen anything yet.

Ithink they want us to kinda learn by ourselves wich is good but....I always like seing it done once and then doing it.That's why im at school in the first place.

Anyways heres what i have basicly done now for now.

Free Styler
10-03-2004, 08:58 PM
ps sorry it's in french but basicly cote is side

SASQUATCH
10-03-2004, 11:18 PM
Go to these links ok and also go to forums that deal with developing.
That is what I do but if you still have problems let me know by PM and I will get you an example but I do believe you will find the answer at these links but you will need to
but them together ok. This is a good way to learn by looking at different example and then picking out what will help. So far I see two examples that will help you but you must figure it out if not then I will have one written up for you.

I am very rusty at Java it's been so long for me ok.

http://examples.oreilly.com/jenut/

http://www.idevelopment.info/data/Programming/java/PROGRAMMING_Java_Programming.shtml

Death Engineer
10-03-2004, 11:45 PM
here's how I would do it in psuedo-code:



int side1 = 0;
int side2 = 0;

// dialog box asking for side1 length
// save return value in side1

// dialog box asking for side2 length
// save return value in side2

// dialog box showing side1 * side2


You need to learn the details on your own if you're going to learn to be a good programmer.

Free Styler
10-03-2004, 11:53 PM
yep i know but sometimes a little help here and there does not hurt.hehe

I'm shure i'll start getting the hang of it in no time hopefully anyways .

I've been on this problem all day.Actully 10 hours straight

tho i havent figured how to do it i did learn a lot of other stuff i did not know.

btw thanks both of you.

SASQUATCH
10-04-2004, 12:11 AM
yep i know but sometimes a little help here and there does not hurt.hehe

I'm shure i'll start getting the hang of it in no time hopefully anyways .

I've been on this problem all day.Actully 10 hours straight

tho i havent figured how to do it i did learn a lot of other stuff i did not know.

btw thanks both of you.

I was just about to tell you ask DE because he would know and I have been out of practice.

PM if you still have a problem but what DE just did I feel is the best way or approach and DE knows his stuff very well.

SASQUATCH
10-04-2004, 12:12 AM
Keep it in mind that the links I gave you are pretty good for ideas.

Free Styler
10-04-2004, 12:22 AM
Well....

might aswell post again then.

Well heres the thing i did exacly what De did earlier today.

But....the problem is the question they asked is that the program
has execute the thingy and that is where iam stuck.

Iam able to bring the dialog to say side 1 *side 2
or side1^2 ithink that is the exponential sign.

But....that is my problem the anwser has to be side 1 = 5 and then...
Well the other dialog box has to say area = 25

So you see, i c'ant find the command line to execute.

Free Styler
10-04-2004, 12:25 AM
relooking at De post tho i'll golook for that save and return line thingy thanks again guys.

Those sites look nice too sasquash

I'lllshurely be looking there in near future.

BobtheCkroach
10-04-2004, 03:48 AM
If you go to

http://java.sun.com/reference/api/index.html

and click on the version of java that you're running, on the next page click "Java 2 Platform API Specification" about 1/2 down...that's an awesome reference.

It's Sun's online reference.

BTW, I'm not incredible w/ Java, but I'm decent...if you ever need help, and have AIM, you can check to see if "Britts Hun 4Ever" is on...that's me! I'm only on around 9pm - 1am EST, but if I'm there I'd be glad to help.

Free Styler
10-04-2004, 08:41 PM
i finally got it to work
i had to take off these" when writting side 1 * side 2
i thought i had tryd it maybe ...
actully maybe i did but changed something else doing so anyways

it was good practice for me to try and find it.
thanks for the links also

i'll be shure to check them out

next time hopefully the question will be harder hehe

SASQUATCH
10-05-2004, 12:01 AM
Trust me FS when you find the problem it helps you become better believe me but again at times it can be useful so keep posting and I am sure one of us especially DE can help.

Glad to hear it went well. Sweet. . . .

Almost forgot go to the forums for Java that is very important ok.

SAS

BobtheCkroach
10-05-2004, 05:17 AM
Trust me FS when you find the problem it helps you become better believe me but again at times it can be useful so keep posting and I am sure one of us especially DE can help.

Glad to hear it went well. Sweet. . . .

Almost forgot go to the forums for Java that is very important ok.

SAS

So true! Getting the easy help from buddies will get you an A on the project, maybe, but it's so much better to do the digging yourself b/c you'll learn it better, and you'll probably find a few other things that are good to know that will come in handy later!

Death Engineer
10-05-2004, 09:59 PM
Glad you figured it out. I may have misunderstood your question. Like the others said, the online API reference for Java will be your best friend for that class. Let us know if you have more conceptual questions.

MattMan
10-08-2004, 05:11 PM
So true! Getting the easy help from buddies will get you an A on the project, maybe, but it's so much better to do the digging yourself b/c you'll learn it better, and you'll probably find a few other things that are good to know that will come in handy later!

I totally agree... But Bob... I recall one instance when you had a little more help than you maybe should have... on some project WE debugged untill 4 am the morning it was do. Just thought I would point out the irony...

Death Engineer
10-08-2004, 05:22 PM
Personal digs should be taken care of through PMs. If it's not relevant to the thread, lets keep it out of the forums other than Off Topic.