Matthew Brown wrote:
I. Ron Nie wrote:In the second version I posted, I called it "DresserApp" and saved it as a file called "DresserApp.java" (after deleting the file "DresserAp.java")
No you didn't. In the second version you posted, you called it "DreserApp" - single "s". Is that error in the real file?
Matthew Brown wrote:Line 1 has a typo: "DreserApp". Is that the cause, or just a transcription error?
Nida Brek wrote:I notice that the 'not found' class is DresserApp, yet your code has a class called DresserAp ...
Matthew Brown wrote:Hi. Welcome to JavaRanch!
You're using integer variables, so they can't cope with anything after the decimal point. So the 0.4 is a problem. 0.4 is a double, so any calculation involving it is also going to give a double.
So when you try and assign that to an integer, you are potentially throwing away everything after the decimal point. The compiler won't let you do that without explicitly saying so. You potentially have this problem every time you convert from a "bigger" to a "smaller" type.
So you've got two options. One, you could use double variables throughout. Or, you can add an explicit cast like this:This is telling the compiler "yes, I know I'm going to lose information, and I'm happy with that".
By the way, the calculation doesn't look right, based on what you've described. I'd expect one of the following: