aspose file tools*
The moose likes Beginning Java and the fly likes Minor problem which im pulling my hair out over Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Minor problem which im pulling my hair out over" Watch "Minor problem which im pulling my hair out over" New topic
Author

Minor problem which im pulling my hair out over

Mark Shrauve
Greenhorn

Joined: Oct 09, 2005
Posts: 4
Hey all.

Im having difficulty with two programs im trying to run. For the first one here is the basic scheme:

A user inputs a value to adjust a knob to an acceptable value between 0 and 100. So lets say the user inputs 7, the program is to display a message saying the current value is 7 right right after it asks for the user input. Then it asks again for another knob change BUT if the user enter like -300 or 200 (anything higher then 100 or below 0) ONLY a warning message is to pop up AND the value must not be changed (THIS IS the part which kills me). How do I make it so when a bad value comes up the the original good value is kept (the 27 for example) and is kept again if the user inputs a bad value (when it displays the current value again). Here is my code so far.
My Test Class:

My function class

What I'm supposed to be getting

Kenneth Albertson
Ranch Hand

Joined: Sep 18, 2005
Posts: 59
Hi Mark. Have a think about this pseudocode. If it does what you require, have a go at writing it in Java.
Mark Shrauve
Greenhorn

Joined: Oct 09, 2005
Posts: 4
Alright cool! Got it, and all I was missing was one dumb else statement with proper coding. One thing that still now I need to check up on is why I keep on getting 0.0 for a reading when my getPosition method is called from the test class.
[ October 10, 2005: Message edited by: Mark Shrauve ]
[ October 10, 2005: Message edited by: Mark Shrauve ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Minor problem which im pulling my hair out over