Fortress Forever

Go Back   Fortress Forever > Off Topic > Chat

Reply
 
Thread Tools Display Modes
Old 04-22-2006, 04:48 PM   #1
o_mooga
 
o_mooga's Avatar
 
Join Date: Feb 2005
Location: A Small Box
Posts Rated Helpful 0 Times
Java Help?

My java 2 prof really stinks.
Does anyone has experiance with java and reading data in from file?
If so if you could eather post here some way I can contact you (AIM, MSN, E-Mail) that would be totaly awesome. I've got a program due monday and I'm having problems BC my prof doesn't teach us sh*t.

Thanks again guys!

Edit: I also have my SN and MSN posted in my prof...
o_mooga is offline   Reply With Quote


Old 04-22-2006, 07:32 PM   #2
o_ekim
 
o_ekim's Avatar
 
Join Date: Dec 2004
Location: Bristol UK
Posts Rated Helpful 1 Times
Code:
import java.util.ArrayList;
import java.io.IOException;
import java.io.FileReader;
import java.io.BufferedReader;

class Input
{
    public ArrayList<String> getInput(String filename)
    {
        BufferedReader input;
        String line;
        ArrayList<String> lineList;
        lineList = new ArrayList<String>();
        try
            {
                input = new BufferedReader(new FileReader(filename));
                while (( line = input.readLine()) != null)
                    lineList.add(line);
                input.close();
            }
        catch (IOException e) 
            { System.err.println("err: " +e.getMessage()); System.exit(1);}
        lineList.trimToSize();
        return (lineList);
    }
}
Something I did a while ago, probably not the best way but it works, Don't have any time to go over this in person, sorry.
o_ekim is offline   Reply With Quote


Old 04-22-2006, 08:04 PM   #3
o_mooga
 
o_mooga's Avatar
 
Join Date: Feb 2005
Location: A Small Box
Posts Rated Helpful 0 Times
Dont worry about it.
The part I'm having problems with we need to use "FileInputStream"
That's about all I know because he didn't explain anything, just posted about 300 pages and informtion about the homework (which is usless).
o_mooga is offline   Reply With Quote


Old 04-23-2006, 12:07 AM   #4
o_docwolfe
 
o_docwolfe's Avatar
 
Join Date: May 2005
Location: Newcastle Upon Tyne, England
Posts Rated Helpful 0 Times
to use a fileinputstream you need to make a buffered reader

BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("path")));

then to read a line you do br.readLine();

so if you wanted to read a whole file and print it out you would add something like this;

while((String line = br.readLine()) != null)
{
System.out.println(line);
}

read the Java tutorial it helps so much, and theres so much information there. http://java.sun.com/docs/books/tutorial/

The API is also helpful but it can get confusing at times. Its such a bitch to find information about stuff on the web. I'm doing Real Time Systems Java at the moment, and dear god, its so hard to find information on it. And the lectures notes we've got are shit.

Last edited by o_docwolfe; 04-23-2006 at 12:20 AM.
o_docwolfe is offline   Reply With Quote


Old 04-23-2006, 01:25 AM   #5
o_vertical
 
o_vertical's Avatar
 
Join Date: Jan 2005
Location: USA, KY
Posts Rated Helpful 0 Times
Long Story, short version about my java classes....

I attended ITT from 2004 to 2005 (Two year degree in Software Applications Programming) and in my Java class (Java 1) we had a Indian teacher (The kind with the little red dot in the middle of thier forehead) which knew basically what was going on, but was still pretty new to the whole thing, I could not understand a dang* word that woman was saying, and she always wrote cursive in a dull red marker on the board so you couldn't read what the heck* she was writing either. Omg I learned like nothing in that class (aside from the crappy* arse* book examples) Then she quit at the end of that class, and our new Java teacher took over for Java 2, he was a younger guy and (27 or so) knew his stuff, problem was my class didn't know jack because of the little indian woman in Java 1, so he assumed we knew everything in Java 1 and started off with tough stuff* right off the bat, and we kept telling him she didn't teach us anything, he wouldn't pay attention to what the heck* we were saying for the first 6 weeks (at which point every single person in the class except one guy who had prior experiance, were failing) we then, as a class proceded to tell him we didn't know jack diddle, and he said there wasn't really anything he could do about it "This far along, I'm going to have to go ahead and give you the regular class project, and I'll try to teach you the best I can for the remaining 4 weeks, but it's going to be tough to do on top of our regular stuff." well basically I got someone to do my project for me, and the guy I got to do it, forgot to enter enough data for the scrollbar to show up on one of the textareas (like was shown in his stupid screenshot) and he counted me off 25 fucking points for it! (I of course don't blame the guy that did it for me at all, how was he suppose to know, heck I wouldn't have done it either most likely) I was like... yeah... so anyway, thats how I passed the class, but I don't know jack about Java... unfortunatly, so like every other language I know, I guess I'll have to start learning it myself here sometime soon on top of working 60+ hours a week.

Sorry for the one big paragraph :P

* Edited for cuss words no need for um' in this post really. - Vert

Last edited by o_vertical; 04-23-2006 at 01:30 AM.
o_vertical is offline   Reply With Quote


Old 04-23-2006, 01:43 AM   #6
o_mooga
 
o_mooga's Avatar
 
Join Date: Feb 2005
Location: A Small Box
Posts Rated Helpful 0 Times
The problem is that every prof teaches java differently and at different speeds.
My Java one class was painfully slow. A friend of mine is taking Java one now. His class is doing programs on the first week that we didn't do untill week 3 or4 (out of ten weeks mind you).
My Java two prof now talks about how things are stored into memory, not how to write java. He also keeps going on about DOS being the coolest thing ever and the only thing cool will be vista. He caries all demos around on a floppy.

So I have learned that DOS was based off Unix, but jack shit about how to code Java.

And the homework asignment are all literaly 7 pages of what the homework should do but doesn't tell us how to do it. He seems to grade easy as long as the program works. And yes, google is my friend. He can't tell if you wrote the code or if he did which is why there are two open note tests to prove that you did. And by open note you can bring in coppies of your programes.
o_mooga is offline   Reply With Quote


Old 04-23-2006, 02:02 AM   #7
o_vertical
 
o_vertical's Avatar
 
Join Date: Jan 2005
Location: USA, KY
Posts Rated Helpful 0 Times
well I did say the final project was done by my friend, but that was for Java 2. Our final exam and project of Java 1 and the final exam of Java 2 (Week 11, though classes end on week 10) I had to do myself, we couldn't use notes, the computer, or even a calculator (yes there was some math involved though I can't remember what. In Java 1, that final exam sucked so hard I got a REALLY LOW grade on it, I think I got like a 45 or something, but I ended up passing the class with a: C+, then I passed Java 2 with a C. The only other 2 classes I got a C+ in where Comp II and College Math III everything else I got B and up (More A's than B's) my GPA when I got out was 3.48, It's lowest point during school was 2.50 which was at the time I hit Java 1 & 2 heh and I brought it back up from there.

I happend to have my academic record sitting beside me at my desk :P

Note:
a C indicates a 2.0
C+ indicates a 2.5

both of which are considered "An average level of achievement".
I never made greater than a B in math I & II ;P "Good level of achievement"

oh, and I was incorrect, I started in June of 2003 to June of 2005.
o_vertical is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:28 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.