Writing data into a file Please Help!
I am having a problem with one part of my program i have to "have a method named "public void generateEmployees(int howmany)". In this method, based
# on the value of the input parameter "howmany", you create "howmany" employees and store them in # the variable "allE" and have a method named "public void storeInfo(String filename)" in which you write out all employee information into a file
" So far I have:
private final Employee[] allE()
{
return allE();
}
public void generateEmployees(int howmany)
{
Employee[] allE = new Employee[howmany];
for(int i = 0; i<howmany; i++)
{
allE[i] = new Employee(Generator.generateName(5), Generator.generateName(4), Generator.generateSSN(), Generator.generateID(6));
allE[i].print();
}
}
public void storeInfo(String filename)throws IOException
{
File file = new File(filename);
if (!file.exists())
{
System.out.println("File does not exist");
System.exit(1);
}
PrintWriter pw = new PrintWriter(filename);
for(int i = 0; i<allE().length; i++)
{
Employee [] a = allE();
pw.print(a);
//*** i think that i am missing a part here!
}
pw.close();
}
I am sorry i do not know much about java any help at all would be greatly appreciated! thank you so much to all who respond!!!