Search:

Type: Posts; User: polop050505

Search: Search took 0.25 seconds.

  1. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    I did that and it works.
    Thank you very much, you were very helpful.
  2. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    I defined the array to hold 100 in the constructor in the Fleet class. Is that right? It works correctly.
    I the Vehicle class I set the parameters equal to the variables and that worked also.

    ...
  3. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    Do you mean just to initialize it to ten or something like that? Because then numOfVehicles will print as 18 when it should be 8.



    import java.io.PrintWriter;
    import java.util.Scanner;

    /*...
  4. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    System.out.println(vhcl[i]);


    Honestly, I don't really know what it in that slot in the array, I think the last index the scanner reads. I realize now that I am trying to use the toString method...
  5. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    I expect it to print out exactly the way it come in. So like this:

    1256BB03457
    Hyundai
    Santa Fe
    2011 18556.0 31195 27301
    true true 5
    5XXCD3AX66
    Kia
    Sorento
  6. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    ok, here's all 3 updated classes. I have the contents of the files in my original post.
    The error in the fleet class is System.out.println(vhcl[i]);
    (I know the comments are off, I haven't worked...
  7. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    import java.io.File;

    public class FleetApp
    {
    public static void main(String[] args)
    {
    Fleet flt = new Fleet();
    File input1 = new File("CarFleet.txt");
    File input2 = new...
  8. Replies
    17
    Views
    1,060

    [SOLVED] Re: Printing arrays

    Sorry, I forgot to post that.



    public class FleetApp
    {
    public static void main(String[] args)
    {
    Fleet flt = new Fleet();
    File input1 = new File("CarFleet.txt");
  9. Replies
    17
    Views
    1,060

    [SOLVED] Printing arrays

    I'm trying to print an array of objects.
    Also numOfVehicles seems to be incrementing because when I initialize it to anything above 8, it prints the number plus 8. If numOfVehicles is not...
  10. Replies
    5
    Views
    1,799

    Re: How to print information from an array

    that works, thanks
  11. Replies
    5
    Views
    1,799

    Re: How to print information from an array

    I changed hasNextLine() to hasNext(). System.out.println(Arrays.toString(yourArray)); and System.out.println(Arrays.deepToString(yourArray)); didn't seem to work. They both printed the memory...
  12. Replies
    5
    Views
    1,799

    How to print information from an array

    When I run the application, the memory address prints to the screen. How do I get it to print the information? This is an example of what it is reading from the file.

    Jason White
    265325222
    31...
  13. Re: How do you call a method from the same non-application class?

    I'm not getting any errors because I have no idea how to even try it. I want to be able to use the read method in the display method, which displays the information of a certain student depending on...
  14. How do you call a method from the same non-application class?

    I have a read method that reads information from a file into an array. I have to be able to call that method to another method in that same class that uses the information in the array. I'v been...
Results 1 to 14 of 14