Objects and Classes

okay so am having a go at teaching myself objects and classes but am losing the will to live. Am trying to create a program which converts celsius into fahrenheit (same as my earlier one) but this time writing the class then writing the method. I have a package called CelsiusTemp and two files in it; first is class

publicclass CelsiusTemp2

{

// attributes

privateint aTemperature;

// methods

publicint getTemp()

{

return aTemperature;

}

publicvoid setTemp(int temp)

{

aTemperature = temp;

}

publicdouble convertToFahrenheit()

{

return 1.8 * aTemperature + 32.0;

}

}

and the second with the methods:

import java.util.Scanner;

publicclass TemperatureTester2

{

publicstaticvoid main (String [] args)

{

Scanner myScanner=new Scanner(System.in);

CelsiusTemp cTemp=new CelsiusTemp();

int myTempC;

double myTempF;

System.out.println("Enter a temperature in degrees Celsius :");

myTempC = myScanner.nextInt();

cTemp.setTemp(myTempC);

System.out.println("A temperature of "+ cTemp.getTemp()

+"C is " + cTemp.convertToFahrenheit()+"F");

}

}

the second set of code has mistakes in it because it keeps saying:

cannot find symbol

all the books just go on instead of just showing the two sets of code and how they link together.

please help me!

[2727 byte] By [helenCol12a] at [2007-10-2 5:29:57]
# 1
CelsiusTemp cTemp= new CelsiusTemp();You don't have a class called CelsiusTemp!
mlka at 2007-7-16 1:31:29 > top of Java-index,Java Essentials,New To Java...
# 2
****** thats cos this is the second version and i cut and pasted it from my first. hang on while i try it xxx
helenCol12a at 2007-7-16 1:31:29 > top of Java-index,Java Essentials,New To Java...
# 3
it still says :cannot find symbolwhen i try and run the project it say it has no main class, i thought the CelsiusTemp was the main class with all it's attributes and methods?
helenCol12a at 2007-7-16 1:31:29 > top of Java-index,Java Essentials,New To Java...
# 4

the "main" class is the method that contains the "main" method...

public static void main (String [] args)

in this case it's TemperatureTester2...

hope this helps...

- MaxxDmg...

- ' He who never sleeps... '

MaxxDmga at 2007-7-16 1:31:29 > top of Java-index,Java Essentials,New To Java...
# 5
thabks for that i selected it as the main class and it worked. the code itself still has thouse wiggly red lines under saying cannot find symbol for the line#CelsiusTemp2 cTemp= new CelsiusTemp2();yet the project worked?why?
helenCol12a at 2007-7-16 1:31:29 > top of Java-index,Java Essentials,New To Java...