In this activity you will design your own class after running a test class.
First, create a new project in Jcreator called Teacher. Add a file to the project called Teacher and another file to the project called TestTeacher. Type in the code below for Teacher.java in that file and do the same for TestTeacher.java. Compile and run the program. Afterwards, design a new class of objects and test programmer. Once you compile the program, place it in the drop box for labs for this unit.
That is what one of my lab projects in my online class is. The problem with having an online class is I can't talk to the teacher whenever I need to and whenever I email him, I don't get an answer until the next day so I lose a day of work. This is what I am given for the project for the project TestTeacher.java. I have Teacher.java running right because it's not supposed to have a main method but this has me stumped. It says that on lines 4 and 7 "cannot find symbol class Teacher". I've tried somethings but nothing seems to help at all. I would like an answer but if you could please give me an explanation to what I'm doing wrong. I'm not trying to cheat, just understand how to do this stuff since this is what I want to do when I'm older.
First you need to import the class Teacher to instantiate this class. This will resolve your problem of "can not find symbol"
so first write the import statement in the starting of the TestTeacher class.
Do not wait to strike till the iron is hot; but make it hot by striking....
it says that it's an illegal start of expression. And I have no clue what you mean by package. If you're talking about the folder that the entire thing is under, and it was just Teacher, wouldn't I type
Forget about importing class Teacher. You don't need to do that if both class Teacher and TestTeacher are in the same package (which they most likely are for your assignment).
Make sure Teacher.java and TestTeacher.java are in the same directory.
Are you using JCreator, or are you doing this on the command line with a simple text editor? If you're compiling the classes manually, then make sure that the CLASSPATH environment variable is not set (or make sure that the current directory is included in the classpath). In a command prompt window, try compiling the classes with commands like these:
I feel so ignorant saying this, but how do I move them to make them in the same directory? My "NetBeanProjects" folder is in Documents and then once you open that, you get to choose between "Teacher" and "TestTeacher". They are in the same workspace though.
Jesper is right about not needing to import anything; in fact you have been given some unhelpful advice about importing.
I suggest you forget NetBeans for the time being. Create yourself a directory and use a text editor to edit the code. Remember you will need two files open. Save them in your "java" directory, go to the command line and invoke the javac and java tools from there. I presume you know how to open the command line?
You can probably copy-and-paste the entire code from NetBeans to your text editor.