ok the error is that it doesnt recognize the package class.

package celsiustofahrenheit;

public class CelsiusToFahrenheit {
	public static void main(String args [])
	{
		double celsius, fahrenheit = 0;
		System.out.println("\n\tEnter temperature in celsius: ");
		celsius = MyInput.readDouble();

		fahrenheit = 1.8 * celsius + 32;

		system.out.println("\n\tThat is " + fahrenheit + " degrees fahrenheit.");
	}
}

is there another way to get around the "package" stuff.. like are there other classes ( I THINK they're called classes, such a newb -- sorry) such as java.io.*; or something that can be put in place of the package stuff?

Thanks.

This implies you have a folder/directory called 'celsiustofahrenheit' and it contains your 'CelsiusToFahrenheit.java' file in it.

Packages organize classes into a hierarchy of related subsystems. In Java classes are placed in specific directories called packages.

A quick solution is you should be able to remove the package line from your source (for simplistic one classs applications.) Packages are best used when you have an application that is calling many support classes.

For example, you may have a file structure like:
com\yourname\convert
com\yourname\converters

Your main application/class (call it 'Convert.java') may reside in 'com\yourname\convert' and would contain a
package com.yourname.convert;
line. If you then call a class called 'CelsiusToFahrenheit.class' which resides in the 'com\yourname\converters' folder, you would then include (in the 'Convert.java' source,) an
import com.yourname.converters.*;
line. This is so the compiler can find the 'CelsiusToFahrenheit.class'.

Of course your 'CelsiusToFahrenheit.java' source has a
package com.yourname.converters;
line

Awesome!! ok, thank you. I fixed that problem quick. I just have one left. When i compile it it tells me this:

"C:\Documents and Settings\Booth\My Documents\java_programs\Ch3Ex9.java:13: cannot resolve symbol
symbol : variable MyInput
location: class Ch3Ex9
celsius = MyInput.readDouble();
^
1 error

Tool completed with exit code 1"

According to your code snippet above, you need a class called MyInput with a readDouble method. I did not see this in your code above. I would assume you may have an additional java file called MyInput.java?? If so it will need to be in the same folder as the 'CelsiusToFahrenheit.java' code. (unless you figured out my rambelings about packages above. :)

ok the error is that it doesnt recognize the package class.

package celsiustofahrenheit;

public class CelsiusToFahrenheit {
	public static void main(String args [])
	{
		double celsius, fahrenheit = 0;
		System.out.println("\n\tEnter temperature in celsius: ");
		celsius = MyInput.readDouble();

		fahrenheit = 1.8 * celsius + 32;

		system.out.println("\n\tThat is " + fahrenheit + " degrees fahrenheit.");
	}
}

is there another way to get around the "package" stuff.. like are there other classes ( I THINK they're called classes, such a newb -- sorry) such as java.io.*; or something that can be put in place of the package stuff?

Thanks.

//*********************************************
Hi!
Your code is OK, but I think the program has problem whit
"celsius = MyInput.readDouble();"
I used another package and your program was OK.
bye
Peter

This article has been dead for over six months. Start a new discussion instead.