Search:

Type: Posts; User: morrism35

Page 1 of 3 1 2 3

Search: Search took 0.23 seconds.

  1. Re: Null Point Exception Error while calling a method

    Here i think.
    input1=sc.findInLine(".").charAt(0);
  2. Re: Null Point Exception Error while calling a method

    This is what worked





    import java.util.Scanner;
    import java.io.*;
  3. Re: Null Point Exception Error while calling a method

    not sure why it's going null after the second iteration when I choose 'y'

    --- Update ---

    Found it. I had to create the scanner object after I called the myGrades.processGrades method instead of...
  4. Re: Null Point Exception Error while calling a method

    After the program goes through the first part of the do-while loop it asked the user do they want to choose another file. The variable is then initialized with the user's choice which is either 'y'...
  5. Re: Null Point Exception Error while calling a method

    I just declared the value at the beginning. The user inputs its value when the user is asked whether they want to process another file.
  6. Re: Null Point Exception Error while calling a method

    It should have the value 'y' if it is on it's second iteration of the loop.
  7. Re: Null Point Exception Error while calling a method

    Hey guys the program actually works I found the problem or problems. Still have one more minor problem when I ask the user if they want to choose another file. It throws a null exception after the...
  8. Re: Null Point Exception Error while calling a method

    The result of chooser.getSelectedFile or whatever file is choosen by JFoleChooser open dialog box
  9. Re: Null Point Exception Error while calling a method

    Line 49 would be the Scanner fileScan line and I cannot find anything wrong with it.

    JFileChooser chooser = new JFileChooser();
    File file = chooser.getSelectedFile();
    Scanner...
  10. Re: Null Point Exception Error while calling a method

    Scanner fileScan = new Scanner(file);
    grade.processFile();//call processFile method

    I don't see where these two files have a null value too them. One is just creating a scanner object and the...
  11. Null Point Exception Error while calling a method

    I'm trying to call the grade.processFile method from the main method but I'm getting this Error below. I'll post my code which includes the main method and the class underneath the error message:
    ...
  12. Replies
    24
    Views
    326

    Re: Reading a text file

    Yes I will certainly take that advice

    --- Update ---

    Random question? What does it take to get really good at programming. I mean enough to be adequate on the job.
  13. Replies
    24
    Views
    326

    Re: Reading a text file

    @Norm Thank you it works perfectly now. I used an if(aScnr.hasNextInt() to check before it read every token. This isn't in my textbook. Guess I'm going to have to rely more on the internet to teach...
  14. Replies
    24
    Views
    326

    Re: Reading a text file

    Teacher didn't want us to use array's. I understand what you are saying about the code not seeing a value and that's why it is crashing. I was under the impression that it would read the file 1 line...
  15. Replies
    24
    Views
    326

    Re: Reading a text file

    My code will not read the last line of the text file. I'm using the method that you said. I'm close but not there yet.Thank you.
    This is the error message I think it is shutting down my file stream...
  16. Replies
    24
    Views
    326

    Re: Reading a text file

    Yes you would be correct. That is my whole problem. When it reads the first 70 it automatically goes to the 100 in which the 100 is copied into the next variable which would be the wrong variable...
  17. Replies
    24
    Views
    326

    Re: Reading a text file

    The first column should be grades for labs.
    The second column should be grades for projects.
    The third column should be grades for test.
    The fourth column should be grades for final exams
    I...
  18. Replies
    24
    Views
    326

    Re: Reading a text file

    This is exactly how the file looks:
    100 90 80 95
    100 80 70
    100 70

    --- Update ---

    my nextInt code does fine if there was a number after the first 70 just under the number 95.
  19. Replies
    24
    Views
    326

    Re: Reading a text file

    My input text file here:
    100 90 80 95
    100 80 70
    100 70

    My first file that i posted I used nextInt().
    I used the nextLine method in my second coded post nextLine method I got

    --- Update ---
  20. Replies
    24
    Views
    326

    Re: Reading a text file

    Didn't I use that example in my first coded post. This was my original code. Only problem was that when I don't have an even number of lines
    it reads that next number into the wrong variable. My...
  21. Replies
    24
    Views
    326

    Re: Reading a text file

    Can you give me an example. These text books don't give you enough information at all. And some of the examples online are way over my head for a beginner
  22. Replies
    24
    Views
    326

    Re: Reading a text file

    I've read it in line by line and parsed it into an int but this is what I'm getting. Not sure what's wrong here.
    Output:
    Labs Projects Tests Final Exams
    Exception in thread "main"...
  23. Replies
    24
    Views
    326

    Re: Reading a text file

    import java.util.Scanner;
    import java.io.*;


    public class MyGrades
    {
    public static void main (String[] args) throws IOException
    {

    int lab, project, test;
  24. Replies
    24
    Views
    326

    Reading a text file

    How do I make the file reader object move to the next line if there is no more input on the line. Here is my text and output file as you can see that my text file column cuts off on the 2nd line...
  25. Replies
    17
    Views
    167

    Re: Golf Program Help

    That line does print but anything inside the loop does not even if I put a simple println statement there
Results 1 to 25 of 53
Page 1 of 3 1 2 3