I did that and it works.
Thank you very much, you were very helpful.
Type: Posts; User: polop050505
I did that and it works.
Thank you very much, you were very helpful.
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.
...
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;
/*...
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...
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
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...
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...
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");
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...