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.
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");
It is very hard to read code written by someone else. Tell us what it is supposed to do and what really happens.
Ad
11-14-2007, 05:43 AM
Rick Alvernaz
11-14-2007, 06:21 PM
Sorry, I should have given more information.
The program is supposed to read a text file that contains information like below....
1 99
2 88
3 77
4 66
5 55
1 10
2 35
5 50
3 60
It supposed to add up the numbers on the right, corresponding with the numbers on the left and right that information to a file. For example there are 105 "5"s and 123 "2"s.
So the new file should look like this
1 109
2 123
3 137
4 66
5 105
However,
When I compile my program...I get this error.
E:\MaxSync\School\SLCC\CIS 1030\Spacely Sprockets\SpacelySprockets.java:56: missing method body, or declare abstract
public static void detailLine (int partTotal, int partNumber);
^
E:\MaxSync\School\SLCC\CIS 1030\Spacely Sprockets\SpacelySprockets.java:61: cannot find symbol
symbol : variable partTotal
location: class SpacelySprockets
summaryReport.writeWord (partTotal, partNumber);
^
E:\MaxSync\School\SLCC\CIS 1030\Spacely Sprockets\SpacelySprockets.java:61: cannot find symbol
symbol : variable partNumber
location: class SpacelySprockets
summaryReport.writeWord (partTotal, partNumber);
^
3 errors
Tool completed with exit code 1
I've also tried using writeWord, writeInt, and writeString.
Nodsu
11-15-2007, 05:58 AM
Remove the semicolon from the end of line 56 (public static void detailLine...).
You seem to be using some course-specific classes (Keyboard, InputFile, OutputFile), so I can't verify the correctness of the program..
Rick Alvernaz
11-15-2007, 01:49 PM
wow, I feel stupid. I can't believe I spent so much time over one semicolon. I knew it would be something simple.
I got the programing running now. Thanks for your help.