swappo1
August 8th, 2009, 08:26 PM
Hello,
I am taking a class in programming in a month and they will be teaching java. I thought I would start early and familiarize myself with java using a library copy of Sams teach yourself java6 in 21 days. I was able to get a simple hello world program with one file to compile and run. When I try to get a program with two files to compile I get some errors. Here is the errors and files:
VolcanoRobot.java
class VolcanoRobot
{
String status; //instance variables
int speed
float temperature;
void checkTemperature() //method
{
if(temperature > 660)
{
status = "returning home";
speed = 5;
}
}
void showAttributes()
{
System.out.println("Status: " + status);
System.out.println("Speed: " + speed);
System.out.println("Temerature: " + temperature);
}
}
VolcanoApplication.java
class VolcanoApplication
{
public static void main(String[] arguments)
{
VolcanoRobot dante = new VolcanoRobot();
dante.status = "exploring";
dante.speed = 2;
dante.temperature = 510;
dante.showAttributes();
System.out.println("Increasing speed to 3.");
dante.speed = 3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperaure = 670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
Errors:
[hopchewer@hopchewer volcanorobot]$ javac VolcanoApplication.java
----------
1. ERROR in VolcanoApplication.java (at line 25)
VolcanoRobot dante = new VolcanoRobot();
^^^^^^^^^^^^
VolcanoRobot cannot be resolved to a type
----------
2. ERROR in VolcanoApplication.java (at line 25)
VolcanoRobot dante = new VolcanoRobot();
^^^^^^^^^^^^
VolcanoRobot cannot be resolved to a type
----------
2 problems (2 errors)[hopchewer@hopchewer volcanorobot]$
I am using gedit along with the terminal plugin. The two files are saved in volcanorobot. Any ideas what I am doing wrong?
I am taking a class in programming in a month and they will be teaching java. I thought I would start early and familiarize myself with java using a library copy of Sams teach yourself java6 in 21 days. I was able to get a simple hello world program with one file to compile and run. When I try to get a program with two files to compile I get some errors. Here is the errors and files:
VolcanoRobot.java
class VolcanoRobot
{
String status; //instance variables
int speed
float temperature;
void checkTemperature() //method
{
if(temperature > 660)
{
status = "returning home";
speed = 5;
}
}
void showAttributes()
{
System.out.println("Status: " + status);
System.out.println("Speed: " + speed);
System.out.println("Temerature: " + temperature);
}
}
VolcanoApplication.java
class VolcanoApplication
{
public static void main(String[] arguments)
{
VolcanoRobot dante = new VolcanoRobot();
dante.status = "exploring";
dante.speed = 2;
dante.temperature = 510;
dante.showAttributes();
System.out.println("Increasing speed to 3.");
dante.speed = 3;
dante.showAttributes();
System.out.println("Changing temperature to 670.");
dante.temperaure = 670;
dante.showAttributes();
System.out.println("Checking the temperature.");
dante.checkTemperature();
dante.showAttributes();
}
}
Errors:
[hopchewer@hopchewer volcanorobot]$ javac VolcanoApplication.java
----------
1. ERROR in VolcanoApplication.java (at line 25)
VolcanoRobot dante = new VolcanoRobot();
^^^^^^^^^^^^
VolcanoRobot cannot be resolved to a type
----------
2. ERROR in VolcanoApplication.java (at line 25)
VolcanoRobot dante = new VolcanoRobot();
^^^^^^^^^^^^
VolcanoRobot cannot be resolved to a type
----------
2 problems (2 errors)[hopchewer@hopchewer volcanorobot]$
I am using gedit along with the terminal plugin. The two files are saved in volcanorobot. Any ideas what I am doing wrong?