This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!

Logan Knecht

Greenhorn
+ Follow
since Jun 05, 2008
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Logan Knecht

Disregard this as I solved it by placing an if test in the digit method checking if numTest = 4 and then setting it to zero if that was the case.

Does anyone have a better suggestion on how to do this because I know this was terribly sloppy.
13 years ago
I made an application for my class that has a functionality such of a basic calculator. It takes digits then turns then appends them to another in increasing magnitude, and once an operation is selected the digit is reset to zero so that another can be added.

Once that is done the equals method is selected and returns the answer, however I'm having a problem. I'm supposed to run it through a test, but when I use the test the only value that returns correctly is the first value, after that it just repeats the same answer over and over again.

I tried several ways to fix this, but haven't succesfully figured out what I have done wrong. If someone could take a look and just tell me if there is a way to reset it so that when runTest() in the Calculator test class performs after the first method, that it resets and repeats accordingly.

I'd really appreciate it.


13 years ago
Ahahahah oh wow, what a stupid mistake.
13 years ago
I made this program to divide by N for each iteration of the while loop, and in doing so it would take the sum of every iteration and print it to the line, the only problem is that the answer I receive is this.

Sum is: Infinity





If anyone knows why I'd love to know. Also, if anyone has any input on how to do this better too, I would love to know.

Thanks.
13 years ago
I'm doing exercise 4 on this site and just wanted some input.

http://chortle.ccsu.edu/CS151/Notes/chap14/progExercises14.html



How would I make it so that the pressure out of range if statement is a method?

Also would



work both ways for each tire so when that runs if either tire is + or - 3 psi it would detect it, or would I have to do it for the leftFront as well?

Any help is appreciated!

Thanks.
13 years ago
Yes, but that still doesn't answer if there is a way to compare types to see if it is a certain type so I can execute something. I just want to know if there is a way to check the type through a command, or compare types.
13 years ago
I was wondering how to test for the type of a variable. for instance say you have variable x, and you want to catch something before you perform a step that needs a specific type, such as int, or float. So rather than it failing when hitting that step it tests to make sure a string isn't there instead of an int.
13 years ago
Okay I understand what you're saying about having to have string args[] as the starting point, is there a way to set the starting point?
[ July 22, 2008: Message edited by: Logan Knecht ]
13 years ago
I have no idea why it's giving me

Exception in thread "main" java.lang.NoSuchMethodError: main

this, could someone explain?

[ July 22, 2008: Message edited by: Logan Knecht ]
13 years ago
I tried assigning x=-1 to the first code I posted and I keep getting that error,

"Exception in thread "main" java.lang.NoSuchMethodError: main"

Do you know why that is?
13 years ago
Ok so I think I get what you're saying. You're saying that x isn't being declared because it wasn't being seen first, so I have to declare it hire up, and outside of the if statements.

So What if I just put the system.out.println statements inside each if statement. Is there a better way to achieve this.

When my code is like this now, though, I get

"Exception in thread "main" java.lang.NoSuchMethodError: main"

Is there any better way to do this?

13 years ago
I wrote some code and I keep getting

info.java:52: variable x might not have been initialized System.out.println(myPeople[x].first + " " + myPeople[x].last + " is " + myPeople[x].age);

I tried figuring out if it was a placement thing, of if it was something else, but I have no idea why it thinks x doesn't exist.

Also, does anyone have a suggestion on how to better do the if statement that assigns x a value?



Thank you for any help or suggestions.
13 years ago
I'm trying to figure out how to put a string into an array so that each letter is put in a spot.

It would take a word like hello and have

test[0] = "h"
test[1] = "e"

and so forth.

The reason I'm trying to do that is because I want to take the numbers that someone could enter and base them off of the numbers column, so that the tens provide a response specific to a prefix, like twenty or thirty, and the ones column is specific to that.

Thanks in advance.
13 years ago
Haha oops, thank you very much.
13 years ago
I just installed the SDK and was trying to run a hellworld.class file that was compiled by javac, but when I do java helloworld.class in the correct directory it gives me this.

C:\Documents and Settings\Work\Desktop>java helloworld.class
Exception in thread "main" java.lang.NoClassDefFoundError: helloworld/class
Caused by: java.lang.ClassNotFoundException: helloworld.class
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

Does anyone know what the problem is or how to fix it?
13 years ago