Jump to content

Does Anyone here Know Java Programming?


Jrod

Recommended Posts

Guest bengalrick
[quote name='Elflocko' post='464222' date='Mar 29 2007, 12:37 PM']Have you tried Netbeans?[/quote]

no this is my first semster w/ java and the first time i've messed w/ it... our teacher gave us the JCreator disc for us to use, but how is Netbeans different/better?
Link to comment
Share on other sites

Its been a while since I worked with Java, but are strings case sensitive? Meaning if you put in "Data.txt" in your dialouge box does it not work?

BTW I need to get a IDE does Netbeans work good and is it easy to install and work right after the install? I installed the javac complilier from sun, but for the life of me cant remember what I need to do to get it to work properly. I know it has something to do with classpath but I cant remember. If I could get a IDE that does the install comeplety for me it would make helping you guys much easier.
Link to comment
Share on other sites

NetBeans is basically .net for Java (as it's made and distributed by Sun), and has a number of cool plugins and some pretty helpful error checking.

The install is pretty painless (especially compared to 4.x).

And best of all it's free.

There is a lot of stuff in it so it can take a bit to get used to, but it's very well done.
Link to comment
Share on other sites

[quote name='Elflocko' post='464238' date='Mar 29 2007, 12:54 PM']NetBeans is basically .net for Java (as it's made and distributed by Sun), and has a number of cool plugins and some pretty helpful error checking.

The install is pretty painless (especially compared to 4.x).

And best of all it's free.

There is a lot of stuff in it so it can take a bit to get used to, but it's very well done.[/quote]


Interesting, Ill have to check it out.
Link to comment
Share on other sites

Guest bengalrick
[quote name='Jamie_B' post='464235' date='Mar 29 2007, 12:50 PM']Its been a while since I worked with Java, but are strings case sensitive? Meaning if you put in "Data.txt" in your dialouge box does it not work?

BTW I need to get a IDE does Netbeans work good and is it easy to install and work right after the install? I installed the javac complilier from sun, but for the life of me cant remember what I need to do to get it to work properly. I know it has something to do with classpath but I cant remember. If I could get a IDE that does the install comeplety for me it would make helping you guys much easier.[/quote]

yes, it is case sensitive but i made sure it was exactly the same...

like i said, if i change the code on line 8 to [i]if (fileName == "data.txt") [/i] instead of [i]if (fileName != "data.txt") [/i] it does just the opposite (allows me past this point reguardless of right or wrong password), so it is a problem w/ my code for sure...

in other words the "if" and "else if" statements are not done properly probably...

[quote name='Elflocko' post='464238' date='Mar 29 2007, 12:54 PM']NetBeans is basically .net for Java (as it's made and distributed by Sun), and has a number of cool plugins and some pretty helpful error checking.

The install is pretty painless (especially compared to 4.x).

And best of all it's free.

There is a lot of stuff in it so it can take a bit to get used to, but it's very well done.[/quote]

hmm... sounds sweet... i might check that out later...
Link to comment
Share on other sites

take the if off of the else if statement so that its just an else and try both the [i]if (fileName == "data.txt") instead of if (fileName != "data.txt")[/i] and tell me what happens (as you dont need to do the check a 2nd time when you hit the elseif statement because when it hits it, it already knows that it isnt "data.txt".
Link to comment
Share on other sites

Guest bengalrick

[quote name='Jamie_B' post='464248' date='Mar 29 2007, 01:05 PM']take the if off of the else if statement so that its just an else and try both the [i]if (fileName == "data.txt") instead of if (fileName != "data.txt")[/i] and tell me what happens (as you dont need to do the check a 2nd time when you hit the elseif statement because when it hits it, it already knows that it isnt "data.txt".[/quote]

i actually added the extra if statement to see if that would help in the first place and just forgot to take it back out of there when it didnt' make a difference... i will try that when i get home again, but i don't think that is it...

i'm so close on this program i can taste it... the code i had posted, i ddin't create the array that stores the data from "data.txt" right, but i think i fixed it now... my main problem is this stupid nested if statements...

about the time i think i got it, reality sets in and i realize i don't... but as soon as it seems impossible, i start to get it...

[i] Just when I thought that I was out they pull me back in. [/i]

:)

Link to comment
Share on other sites

Guest bengalrick
[quote name='Jamie_B' post='464258' date='Mar 29 2007, 01:13 PM']Give me a few minutes Im going to install netbeans (with the JDK included) and see if I can figure out how to use it.[/quote]

sweet.... i really appreciate this...
Link to comment
Share on other sites

Guest bengalrick

[quote name='Jamie_B' post='464273' date='Mar 29 2007, 01:31 PM']ok I have netbeans working now, Im gonna get some lunch and look a this a bit later.[/quote]

but i dont' have time for that shit man....


















j/k, take your time B)

Link to comment
Share on other sites

Ok while Im eating I have half of it figured out. (And Im remembering why I hated the nuances of Java)

For whatever reason the showInputDialog doesnt like the == comparison so use the .equals or .equalsIgnoreCase like so... (and use ! for the NOT equal)

[code] fileName = JOptionPane.showInputDialog (null, "Enter the file name to use (data.txt)");
// asks user to enter the file name
if (fileName.equalsIgnoreCase("data.txt"))
{
String password = JOptionPane.showInputDialog(null, "Enter the password");
while (!password.equalsIgnoreCase("INF260"))
{
missedPassword++;
if (missedPassword == 3)
{
JOptionPane.showMessageDialog (null, "Too many tries");
System.exit(0);
}
}
}
else
{
JOptionPane.showMessageDialog (null, "File not found");
System.exit(0); // Stops system if right file name is not entered
}[/code]


Now you still need to figure out the best way to approace the password thing as the 2nd showInputDialoge is outside of your while and you will only get it to work the 1st time. I think you might want to give it its own method for the password then just enter that method on each pass of the loop.
Link to comment
Share on other sites

Guest bengalrick
[quote name='Jamie_B' post='464298' date='Mar 29 2007, 02:40 PM']Ok while Im eating I have half of it figured out. (And Im remembering why I hated the nuances of Java)

For whatever reason the showInputDialog doesnt like the == comparison so use the .equals or .equalsIgnoreCase like so... (and use ! for the NOT equal)

[code] fileName = JOptionPane.showInputDialog (null, "Enter the file name to use (data.txt)");
// asks user to enter the file name
if (fileName.equalsIgnoreCase("data.txt"))
{
String password = JOptionPane.showInputDialog(null, "Enter the password");
while (!password.equalsIgnoreCase("INF260"))
{
missedPassword++;
if (missedPassword == 3)
{
JOptionPane.showMessageDialog (null, "Too many tries");
System.exit(0);
}
}
}
else
{
JOptionPane.showMessageDialog (null, "File not found");
System.exit(0); // Stops system if right file name is not entered
}[/code]
Now you still need to figure out the best way to approace the password thing as the 2nd showInputDialoge is outside of your while and you will only get it to work the 1st time. I think you might want to give it its own method for the password then just enter that method on each pass of the loop.[/quote]

good call on the password method... another method will make it much easier to understand and should make it work right...

as far as the *.equals although i haven't learned that yet, if it works i'll take it... does that make it work right, using that instead of "=="?
Link to comment
Share on other sites

[quote name='bengalrick' post='464303' date='Mar 29 2007, 02:46 PM']good call on the password method... another method will make it much easier to understand and should make it work right...

as far as the *.equals although i haven't learned that yet, if it works i'll take it... does that make it work right, using that instead of "=="?[/quote]


yep, i just ran a test before I posted the code for that. (Thanks Elflocko for the netbeans)
Link to comment
Share on other sites

Usually it is pretty easy. Set the current time, and the time you want it to start brewing. Add the water, filter, Java, and hit the hay. Boom, it is ready when you wake up.

[attachment=224:gbx23.jpg]

I really counldn't exsist
And yes....ElfFlocko...I know...JAVA not Java, java, or jAvA :)

Link to comment
Share on other sites

[quote name='Montana Bengal' post='464331' date='Mar 29 2007, 02:25 PM']Usually it is pretty easy. Set the current time, and the time you want it to start brewing. Add the water, filter, Java, and hit the hay. Boom, it is ready when you wake up.

[attachment=224:gbx23.jpg]

I really counldn't exsist
And yes....ElfFlocko...I know...JAVA not Java, java, or jAvA :)[/quote]


:onoudidnt:



:lol:


This version of NB is the best one they've ever done.

Too bad I'm such a rotten programmer. <_<



Glad it worked out for everyone!

Link to comment
Share on other sites

Guest bengalrick
hey Jamie, just for a reference, with that code you wrote there, did the password part work for you if you type in the wrong password?
Link to comment
Share on other sites

[quote name='bengalrick' post='464819' date='Mar 30 2007, 01:37 PM']hey Jamie, just for a reference, with that code you wrote there, did the password part work for you if you type in the wrong password?[/quote]


No I didnt fix that part (I had assumed you would), well what I should say is what happens is that it just goes straight to the "too many tries" thing if the password is wrong (if its right it works like its supposed to), the reason for this is that your password variable is set outside of your while loop but you never allow for the user to put a new password in inside of your while loop so it continues to be the wrong password and adds the counter till it hits 3 and then quits. It works like the code is written you just need to add another inputDilouge within your while loop (but without the Sting before hand as the password vairable is already declared) So like this.... (tested and it works like your looking for)

[code]fileName = JOptionPane.showInputDialog (null, "Enter the file name to use (data.txt)");
// asks user to enter the file name
if (fileName.equalsIgnoreCase("data.txt"))
{
String password = JOptionPane.showInputDialog(null, "Enter the password");
while (!password.equalsIgnoreCase("INF260"))
{
missedPassword++;
if (missedPassword == 3)
{
JOptionPane.showMessageDialog (null, "Too many tries");
System.exit(0);
}
password = JOptionPane.showInputDialog(null, "Enter the password");
}
}
else
{
JOptionPane.showMessageDialog (null, "File not found");
System.exit(0); // Stops system if right file name is not entered
}[/code]
Link to comment
Share on other sites

Guest bengalrick

[quote name='Jamie_B' post='464873' date='Mar 30 2007, 03:27 PM']Rick have you taken a program design course yet? One that teaches you about psudocode or flowcharting or how to write software (as opposed to just straight coding) yet?[/quote]

no, not yet... i could DEFINATELY use it too, b/c i think one of my main problems is getting started, and figuring out what i need to do first and whatever... as far as schooling, i am took literally all my general courses first, then quit b/c i was extremely burnt out and working 50+ hours a week selling cars... but now that i have a job that a) i work 40 hours a week and B) they pay for my schooling, i finally went back and am just now getting to courses that i will actually need (and are interesting to me)... i have a database class this semester too, and i love it... i get oracle real well for whatever reason, but then again we are doing very basic stuff... but this java is supposidely basic too, and its driving me crazy :)

with this particular program, i was running into a wall... i literally put about 20+ hours on this one program this week, and come to fine out it was the exact same problem you ran into with the ".equals" instead of ==... i was kicking myself after trying everything to figure that out on my own... i finally broke down and sent my code and asked why the hell it wasn't working and felt pretty dumb when she told me the solution, and it was the same exact solution you had shown me...

anyways, thanks for helping me w/ my java work man... i am getting better, and i have taken other programming courses before, but none as stubburn as this one... its unbelievable at times, really...

Link to comment
Share on other sites

Yeah no problem at all, its been a couple years since I took the class so Im rusty in it anyway. But if the school your going to has a class like that I would suggest that be your next one before you do any more programming courses, its very helpful. Something like this.. (this is a class at mason)

308/INFS 310 Program Structure and Design for Business Applications (3:3:0) Prerequisite: computer programming course in high school or college. Teaches structured programming and design using high-level language. Focuses on program design, coding, debugging, and documentation.
Link to comment
Share on other sites

This thread has actually been good for me as I just signed up for my next course for the summer semester (and my last 200 level course, but i have 1 100 level math course, then everything else is 300 and 400 level)

BAM

207 Applied IT Programming (3:3:0) Prerequisite: IT 108 or CS 112, or permission of instructor. Intermediate Java and socket programming, and CGI scripting; POSIX concepts and tools to support web-based applications



So keep the questions comming.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...