Search:

Type: Posts; User: polop050505

Search: Search took 0.10 seconds.

  1. Replies
    17
    Views
    1,051

    [SOLVED] Re: Printing arrays

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

    [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,051

    [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,051

    [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,051

    [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,051

    [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,051

    [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,051

    [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,051

    [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...
Results 1 to 9 of 9