Can someone please look at this, I'm sure I'm just missing something really easy. Something is wrong with my Method. I'm brand new to java, so don't laugh.
I realize you can't see everything...put maybe someone can spot the problem real quick.
I realize you can't see everything...put maybe someone can spot the problem real quick.
Code:
public class SpacelySprockets
{
public static void main(String[] args) //Main Program
{ //Start Main
int partNumber=0;
int quantity=0;
int part1Total=0;
int part2Total=0;
int part3Total=0;
int part4Total=0;
int part5Total=0;
Keyboard kbd;
kbd = new Keyboard ();
InputFile sprockets;
sprockets = new InputFile ("E:\\MaxSync\\School\\SLCC\\CIS 1030\\Spacely Sprockets\\sprockets.txt");
while (!sprockets.eof())
{ //Start Loop
partNumber=sprockets.readInt ();
quantity=sprockets.readInt ();
switch (partNumber)
{
case 1: part1Total = part1Total + quantity;
break;
case 2: part2Total = part2Total + quantity;
break;
case 3: part3Total = part3Total + quantity;
break;
case 4: part4Total = part4Total + quantity;
break;
case 5: part5Total = part5Total + quantity;
break;
default: System.out.println ("The file has unknown part numbers ltstd");
}
} //End Loop
detailLine (part1Total, 1);
detailLine (part2Total, 2);
detailLine (part3Total, 3);
detailLine (part4Total, 4);
detailLine (part5Total, 5);
} //End Main
public static void detailLine (int partTotal, int partNumber);
{
OutputFile summaryReport;
summaryReport = new OutputFile ("E:\\MaxSync\\School\\SLCC\\CIS 1030\\Spacely Sprockets\\summaryReport.txt");
summaryReport.writeWord (partTotal, partNumber);
summaryReport.writeEOL();
summaryReport.close();
}
} //End Class