who fancies being a lifesaver
I have made tokens. these tokens are meant to be altered if they are null. this does not seem to work all the time in this loop. Any thoughts why?
the tokens have been declared outside the loop as have the strings (that they were assigned to) that you can see here.
this is my last significant problem on my first Java lab (due tomorrow). It's frustrating.
try
{
FileOutputStream outStream = new FileOutputStream ("billingReport.txt"
);
aWriter = new PrintWriter (outStream);
if(em[1] == null)
{
em[1] = "*ERROR* *name missing*";
}
if(en[4] == null)
{
em[1] = ("*ERROR* " + em[1]);
en[4] = "*hours missing*";
h = "";
}
if(co[1] == null)
{
em[1] = "*ERROR* " + em[1];
co[1] = "*description missing*";
}
if(en[2] == null)
{
em[1] = "*ERROR* " + em[1];
en[2] = "*entry date missing*";
}
aWriter.println (em[1] + " charged " + en[4] + h + " to " + co[1] +
" on " + en[2]) ;
System.out.println (em[1] + " charged " + en[4] + h + " to " + co[1]
+ " on " + en[2]) ;
}
the tokens have been declared outside the loop as have the strings (that they were assigned to) that you can see here.
this is my last significant problem on my first Java lab (due tomorrow). It's frustrating.
try
{
FileOutputStream outStream = new FileOutputStream ("billingReport.txt"
);
aWriter = new PrintWriter (outStream);
if(em[1] == null)
{
em[1] = "*ERROR* *name missing*";
}
if(en[4] == null)
{
em[1] = ("*ERROR* " + em[1]);
en[4] = "*hours missing*";
h = "";
}
if(co[1] == null)
{
em[1] = "*ERROR* " + em[1];
co[1] = "*description missing*";
}
if(en[2] == null)
{
em[1] = "*ERROR* " + em[1];
en[2] = "*entry date missing*";
}
aWriter.println (em[1] + " charged " + en[4] + h + " to " + co[1] +
" on " + en[2]) ;
System.out.println (em[1] + " charged " + en[4] + h + " to " + co[1]
+ " on " + en[2]) ;
}
