Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthoradmin
    • CommentTimeJan 29th 2008
     
    This discussion relates to problems/issues/questions regarding Project 2
    • CommentAuthorjmscott2
    • CommentTimeFeb 3rd 2008
     
    i don't know if anyone else has started working on this... i was just wondering if we are supposed to keep the file the same with the ByteBuffer and continue working with each character one at a time the way the current program does. Otherwise is there a way to look at one word at a time?
    • CommentAuthoradmin
    • CommentTimeFeb 3rd 2008
     
    You can do it however you want as long as the result works. That said, the ByteBuffer in the sample program already works and is the easiest way to do it. But feel free to explore other options if you want.
    • CommentAuthorzdhayes
    • CommentTimeFeb 4th 2008
     
    Is anyone else using JGrasp? I can't remember what Dr. Garrett said about using JGrasp. Wasn't there something extra or a little bit different we have to do compared to using a different program?
    • CommentAuthorjmscott2
    • CommentTimeFeb 5th 2008
     
    In JGrasp you have to check the "Run Arguments" option under Build on the top menu bar. A text box will appear at the top of the code window, so you just have to type in the names of the input and output files before running the program.
    • CommentAuthortdgray
    • CommentTimeFeb 7th 2008
     
    Similar question to above; I know Dr. Garrett showed us in class, but I don't recall.. how do you get the arguments initially passed in Eclipse?
    • CommentAuthoradmin
    • CommentTimeFeb 7th 2008
     
    1. Highlight your class on the left
    2. From the menu, select the run icon, get the dropdown menu, and choose RUN
    3. The run dialog box should appear. In that dialog box there is a tab that says "arguments"
    4. Click on the arguments tab and place your arguments in the "program arguments" box
    5. Those arguments will remain in place until you remove them or change them. Anytime your run the program, the arguments will be used.
    • CommentAuthortdgray
    • CommentTimeFeb 9th 2008
     
    Would it be safe to assume that the test files used will be in the same format as the sample (single space between each first and last name, carriage return after each record) ?
    • CommentAuthortdgray
    • CommentTimeFeb 9th 2008 edited
     
    Also does "mixed character" mean the way that the characters are already in the input file?

    I noticed that in the Project 2 requirements it says "mixed characters (first letter upper case, remainder lower case)", but some people have some odd last names with capital letters in the MIDDLE of their last names that could potentially throw a wrench in the output, depending on how its processed. To solve this, the code could just throw the byte exactly how it is into the buffer, which would work unless the input file was say... entirely in lower case and the desired output was to have the first letter of the last names capitalized.

    But the output of trying to format an unformatted input of entirely lower case (ex. output: Warden-michl) could be potentially as incorrect as unformatted input file remaining unformatted (ex. output: warden-michl). I see no good solution unless the input file is already formatted into the correct "mixed characters." I hope that is what is expected?
    • CommentAuthorjmscott2
    • CommentTimeFeb 9th 2008
     
    I was wondering the same thing about the mixed case. For my output, mixed case means exactly what the assignment said: first letter uppercase, the rest lowercase. So when the switch -X is used, the output is Warden-michl, etc.
    • CommentAuthorcbdirks
    • CommentTimeFeb 10th 2008
     
    I'm having some issues getting things rolling here. I guess the main problem I'm having is creating a string for each record so I can parse it into last and first names.

    Is it possible to parse the file by using FileChannels and ByteBuffers? I'm stumped.
    • CommentAuthortdgray
    • CommentTimeFeb 10th 2008
     
    You could use StringTokenizer but I think its easier to use the char c that's already in the program to delimit the names with your own code.
    • CommentAuthorcbdirks
    • CommentTimeFeb 10th 2008
     
    Yes, i figured using c is the way to go, but I can't figure out a viable way to delimit by using char c.
    • CommentAuthoradmin
    • CommentTimeFeb 10th 2008
     
    For this assignment, "mixed case" means capitalizing the first letter of each name. Obviously, that technique wouldn't always work in real life, but that's the expectation for this assignment.
  1.  
    sorry my last name is #$Q#in everything up...
  2.  
    so...I can't even get the source program to run because I don't know how to f-ing input the run arguments properly...so

    using JGrasp:
    what do I type into the run argument command line in order to get this program to show me what it does?
    • CommentAuthortdgray
    • CommentTimeFeb 10th 2008
     
    [name of input file] SPACE [name of output file]

    " infile.txt outfile.txt "

    infile must be in the directory that the code is in.

    Also, if you haven't taken out the first line in the sample code that includes the samples package, that might be the source of your problem.
    • CommentAuthorjmscott2
    • CommentTimeFeb 10th 2008
     
    when using the char c, you can test to see if c == ' ' (space) or c == ',' or c == '\n' (new line) to determine where the ends of the last and first names are.
    • CommentAuthordtran
    • CommentTimeFeb 10th 2008
     
    In JGrasp, check the box Run Argument in Build and a text box should appear above your codes. Hope that helps.
    • CommentAuthormdcarr
    • CommentTimeFeb 11th 2008
     
    I'm having trouble with the argument check, as long as anything is typed in as the third argument it'll do the check and run with the -X or a non -X arg, but if there isn't a 3rd at all I get a ArrayIndexOutOfBoundsException and not sure what to do about it.

    I know it's a little late to post this, but figured I wouldn't be the only one doing this last minute.
    • CommentAuthorcdstreit
    • CommentTimeFeb 11th 2008
     
    sounds like you are trying to access args(2) when nothing is their, causing a exception. To fix this you will need something to make sure you have a 3rd argument. somthing like
    if (args.length >= 3)
    then do the check if it is a -X or not

    hope it helps
    Chris
    • CommentAuthormdcarr
    • CommentTimeFeb 11th 2008
     
    ya, I completely overlooked that.. thanks
    • CommentAuthorkdtaylor
    • CommentTimeFeb 11th 2008
     
    im having problems getting the names to appear properly in the file. the way i tried doing it was putting the characters that i read in from the inputfile into a string until i reached a comma then changing the whole string to uppercase. when i tried writing the sstring to a file i got errors so i put it into a for loop and tried ouputting the characters one a time into the output file. but im still having problems

    for ( int count = 0; count < name.length(); count++ ) {
    letter = name.charAt(count);
    bb.put( i, (byte) letter );
    fcout.write( bb );
    here is the code i have for outputting to the file i, bb fcout are all the same as in the original. does anyone see anything wrong that they assist me with? any help is appreciated
    kevin
    • CommentAuthormdcarr
    • CommentTimeFeb 11th 2008
     
    I had issues with mine when I tried to check for the comma to change case, my problems went away when I started checking for the blank space. Then I simply used a trigger to control case. if trigger == 0 Ucase, else Lcase.. controlled it with if statements. had two sets of if's controlling wether it had the -X or not
    • CommentAuthorcdstreit
    • CommentTimeFeb 11th 2008
     
    kevin, quick look at that seems to me like the fcout.write(bb); would cause problems if it was in the loop. Not 100% sure but i would try removing it from the loop, and having it write the file after the loop is done. Something like
    bb.rewind;
    fcout.write(bb);
    should write everything in the buffer after the loop is done.
    This is just my 2am thoughts and a quick look at what you posted... may not help at all

    Chris