LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 532 users online 186531 members 879 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Video | Dictionary | News | FAQ
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
6 online / 22 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic

Why won't this work?!
Replies: 14Last Post Aug. 15, 2006 6:29pm by Whuppee
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( ana )


Guru

Patron
Reply
I've been trying to learn Java from a book (because for some reason, I thought it was a good idea). It told me to make a file called VolcanoRobot.Java and put this in it:

Code:
class VolcanoRobot {
String status;
int speed;
float temperature;

void checkTemperature() {
if (temperature > 660) {
status = "returning home";
speed = 5;
}
}


void showAttributes() {
System.out.println("status: " + status);
System.out.println("Speed: " + speed);
System.out.println("Temperature: " + temperature);
}
}

And then it says to make another file called VolcanoApplication.Java which has this inside:

Code:
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.temperature = 670;
       dante.showAttributes();
       System.out.println("Checking the temperature.");
       dante.checkTemperature();
       dante.showAttributes();
   }
}

When I try and compile the application, I get the following errors:

Code:
Ana:~ Ana$ javac desktop/Java/VolcanoApplication.Java
desktop/Java/VolcanoApplication.Java:3: cannot find symbol
symbol  : class VolcanoRobot
location: class VolcanoApplication
       VolcanoRobot dante = new VolcanoRobot();
       ^
desktop/Java/VolcanoApplication.Java:3: cannot find symbol
symbol  : class VolcanoRobot
location: class VolcanoApplication
       VolcanoRobot dante = new VolcanoRobot();
                                ^
2 errors

WHICH IS REALLY ANNOYING SINCE I DID EXACTLY WHAT THE BOOK SAID! I even copied the code off their website so I could make sure the problem was with the code, not something I'd done wrong...

Anyway, since that didn't work, I then combined the two files which let me compile it without a problem but it wouldn't let me run the program...

This is reeeeeeeeeallllllllllly annoying. Can someone help? Please?

-------
Roses are #FF0000
Violets are #0000FF
I am a geek
And so are you


10:02 am on Aug. 11, 2006 | Joined May 2005 | 557 Days Active
Join to learn more about ana England, United Kingdom | Straight Female | 5959 Posts | 21475 Points
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic