Search:

Type: Posts; User: taze

Page 1 of 2 1 2

Search: Search took 0.14 seconds.

  1. Replies
    2
    Views
    1,145

    java is disregarding negatives at will?

    here is my current code:



    removing code for privacy purposes.

    as you can see, subtract and multiply are not giving what they should output (i haven't fiddled with divide yet). i have no idea...
  2. Replies
    2
    Views
    1,146

    Re: Row is column and vice versa?

    EDIT: Figured it out, my rows/cols were swapped in the swap method. Oops.
  3. Replies
    2
    Views
    1,146

    Row is column and vice versa?

    For some reason, my code is that column is acting as a row and row acting as a column. Row should be the horizontal count, column being the vertical (as specified by my professor), however they have...
  4. Replies
    5
    Views
    1,073

    Re: Using args level arguments

    I fixed the second (the y's being v's) with a minor tweak in the decrypt method, I have no idea how, in the above code, I can save the newline characters so the output will print out correctly.
  5. Replies
    5
    Views
    1,073

    Re: Using args level arguments

    So I have it all done, now I just have one really bizarre issue.
    You know Archie Comic's Svenson? For some reason that is the accent of my decryption software.
    The output that is supposed to come...
  6. Replies
    5
    Views
    1,073

    Using args level arguments

    What I need to do is use the args command to choose which method to go to. For instance, I have methods encrypt, decrypt, and crack. The user will open their command and prompt this:
    ...
  7. Re: Turning the letters in a character array to integers.

    What we're supposed to do is make it so that it finds the most common letter, that most common later is therefore 'e' (this is the premise). We then (or before, whichever I can get working) convert...
  8. Re: Turning the letters in a character array to integers.

    Thanks, so I got the encrypter working perfectly...now I'm working on making something that decrypts. To do that, I want it to find the most common letter in the array and it will see it's distance...
  9. Re: Turning the letters in a character array to integers.

    Then why doesn't
    if (array[i] != space) {
    (int) array[i] = (int) array[i] - 97;
    work? I am trying to cast int array and subtract 97 from the number, however the compiler gives the...
  10. Re: Turning the letters in a character array to integers.

    Ooh yes, that is a useless if statement.

    I had assumed that
    int charAsNum = array[i] was supposed to change the array, so that it takes the letter and turn it into a number. Is there any way to...
  11. Re: Turning the letters in a character array to integers.

    Oops, I guess I should have been clearer, what happens is that the output (displayed thanks to System.out.println(array[i])) is the original array, so it is printing out a b c, what it should be...
  12. Turning the letters in a character array to integers.

    So the goal of the assignment (or this direct part I'm working on at the moment) is to take an input (in this case, the file just has 'a b c d' in it.) and using a key (say by adding 5) take the...
  13. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    Here is the error message I am getting:

    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String ind
    ex out of range: -1
    at...
  14. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    So I have this:



    import java.util.*;
    import java.io.*;
    public class StoryGenB {
    public static void main(String[] args) {
    file();
    }
  15. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    So I fixed that so the current code is this:


    import java.util.*;
    import java.io.*;
    public class StoryGenB {
    public static void main(String[] args) {
    file();
    }
  16. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    So I did realize that I wasn't printing anything out to the filewriter, and I renamed it like above so that my code is now this:


    import java.util.*;
    import java.io.*;
    public class StoryGenB {...
  17. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    Doesn't f.close() near the end of the code do the flush/closing of the FileWriter? It still only creates a blank document instead of writing the text.
  18. Replies
    13
    Views
    1,593

    Re: PrintStream, strings and reading from a file.

    Unfortunately, FileWriter is not something I've learned and I have any idea how to implement to the above code, likewise the file we have to use to bring the story has to be declared early on (when...
  19. Replies
    13
    Views
    1,593

    PrintStream, strings and reading from a file.

    I've gotten sort of stuck on my assignment for my Java class and I was wondering if anyone could point me in the right direction.

    The general idea of what is intended is that the computer will...
  20. Re: Stopping while loop if there are insufficient funds.

    Well that worked and I'm a little embarrassed I missed that! Thanks so much for the help.
  21. Re: Stopping while loop if there are insufficient funds.

    I looked and I don't need the initial yes/no answer, so I got rid of it.

    So the goal is to allow them to choose play again as long as they have a positive bankroll, however once their bankroll is...
  22. Stopping while loop if there are insufficient funds.

    So basically, when someone's bankroll gets to 0 or below 0, I want the program to end so they cannot play any longer. Here is my current code:



    import java.util.*;
    public class Craps {...
  23. Re: Attempting to calculate a budget and using public static double method(...)

    It compiles and with a few minor tweaks to the basic mathematics it works as it's supposed to! Thank you so much for the help and sorry for being so confused! You really cleared it up, thank you!
  24. Re: Attempting to calculate a budget and using public static double method(...)

    3. So basically, you're saying that what I am attempting to do is do a calculation without stating the variables first - trying to define c before I define a and b.

    So I thought to, in place of...
  25. Re: Attempting to calculate a budget and using public static double method(...)

    Unfortunately - I don't see it clearly.

    You state:
    Should the calculateTermBudget() method be called first, or should the other methods be called first with their results used to call the...
Results 1 to 25 of 29
Page 1 of 2 1 2