Thomas Mahoney

Greenhorn
+ Follow
since Oct 04, 2018
Thomas likes ...
Eclipse IDE Firefox Browser Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Thomas Mahoney

Thanks, guys.  I fixed it, and you helped a lot.  Oh, and line 37 is the tail end of a Do While loop meant to repeat this entire switch statement while the enclosed variable's value is greater than 0, only I didn't include the entire loop statement.

Thanks Again.
1 month ago
Can anyone fix this code for me?



Thanks.
1 month ago
When I press the enter key in the IDE editor window, a "do not enter" icon appears at the bottom right of the screen.  When I click on it, it tells me...

Unexpected Exception

com/sun/tools/javac/util/cancelAbort

What does this mean, and how do I get my enter key back when using NetBeans?

Thanks.
1 month ago
Just for practice, I'm writing a program that rounds a number to the nearest hundredth, but can't get the expected result.  I'm trying to multiply a double value by 100, round it with Math.round(), then divide the entire result by 100 again to create a decimal rounded to the nearest hundredth.  Instead, I get an integer value.

My code:



Result:  1.0

Expected Result:  1.23

What's going on?
2 months ago
import java.util.Scanner;

What the heck's the matter with this code?  It just keeps cycling through the "incorrect password" statement endlessly, instead of moving on the way it's supposed to.  What am I doing wrong?

4 months ago
I'm trying to write a program that says different things based on an integer value.  It needs to say one thing if the integer is between 1 and 12, and another if the integer is between 13 and 19, and so on.  Here's the code:



Now let's pretend the preceding code is contained within the required class definition and main() method.  I know that's not how you write a case statement, but I don't know how to define a range of values without defining an entire array.

Also, how does one use an expression in a case statement?  I'm having trouble with that, too.

Thanks.
4 months ago
Sorry.  I've already found the answer, but it was in Beginning Java, instead of Java in General.  Next time I'll search both forums.
6 months ago
When divide two floating point numbers, I get a huge long decimal - for example: 0.9999981345 instead of 1.0.  How do I fix this?  Is there a way to round the result to the nearest hundredth?

Here's my code:

6 months ago
I am trying to access my Java class, stored in /home/tmahoney/Java directory, from the directory /home/tmahoney.  It can't find the class.  The program only launches when I'm working in the same directory as its class file.  I've tried setting the CLASSPATH variable, but to no effect.

I am using Ubuntu 14.4 with Linux.  How do I launch a Java class file stored in one directory from any directory?  Thanks.
7 months ago
Hey, guys.  Thanks for all of your help.  You really saved this program.
8 months ago
My calculations are not working.  I keep getting the same results, no matter what numbers I put in to begin with.  Here's the code:



This gives me 0.0C and 273.15K every single time.

What's going on?  Thanks.
8 months ago
Instead of going through the code line by line, it skips over one of the lines of code, going from the end of the "age" block to the end of the "hobby" block, without pausing for user input the way it is supposed to.  Here is my code...



The output is as follows...



Can anyone help?  Thanks.
8 months ago