How to make sure user type valid value? If valid -- Proceed

Me develop a java console program.
BufferedReader request = new BufferedReader(new InputStreamReader(System.in));
String strpollutantNumber;
int pollutantNumber;
System.out.print("Enter pollutant number >> ");
strpollutantNumber = request.readLine();
pollutantNumber = Integer.parseInt(strpollutantNumber);
I want to control my pollutant number and make it always valid. Let's say, pollutant number is between 1 to 4 only. If user press 5, system ask to re-enter valid value as follow
Your pollutant number is invalid. Please re-enter.
Enter pollutant number >>
Did i need using loop at
System.out.print("Enter pollutant number >> ");
strpollutantNumber = request.readLine();
pollutantNumber = Integer.parseInt(strpollutantNumber);
or something..
need help.

so far, i want to control user input using
while ( ......)
user must enter value >=0.31 and <=0.39. if user enter value=0.29, it means this value is out from >=0.31 and <=0.39. see below program
while(gramEmitted>=0.31 && gramEmitted<=0.39) {
System.out.print("Your grams emitted value is not valid ... Please re-enter \n");
System.out.print("Enter number of grams emitted per mile >> ");
strgramEmitted = request.readLine();
gramEmitted = Double.parseDouble(strgramEmitted);
i want user will prompt >> Your grams emitted value is not valid .. Please re-enter \n
Enter number of grams emitted per mile >>
what i've now is when user enter value=0.29, the program not prompt the user to re-enter the value again.
how to adjust
while(*gramEmitted>=0.31 && gramEmitted<=0.39*) {
System.out.print("Your grams emitted value is not valid ... Please re-enter \n");
System.out.print("Enter number of grams emitted per mile >> ");
strgramEmitted = request.readLine();
gramEmitted = Double.parseDouble(strgramEmitted);
Edited by: Delinda on Oct 21, 2008 11:26 PM

Similar Messages

  • The etag value \'\"1\"\' specified in one of the request headers is not valid. Please make sure only one etag value is specified and is valid.

    I try to receive data from a SharePoint List by using REST Services. (_vti_bin/ListData.svc)
    This approach worked fine for some days, until I get an error 400 with following error message:
    "The etag value 1 specified in one of the request headers is not valid. Please make sure only one tag value is specified and is valid."
    Hope anybody can help.
    Many thanks in advance.
    

    Hi,
    According to your post, my understanding is that you had an issue about retrieve data form list using REST in SharePoint 2010.
    I had created a simple demo to retrieve a list item, you can check with the following code snippets.
    <script src="http://code.jquery.com/jquery-1.10.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("callCSOM");
    function callCSOM()
    $("#Button1").click(function()
    ExecuteOrDelayUntilScriptLoaded(ready, "sp.js");
    function getListItemById(webUrl,listName, itemId, success, failure) {
    var url = webUrl + "/_vti_bin/listdata.svc/" + listName + "(" + itemId + ")";
    $.ajax({
    url: url,
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
    success(data.d);
    error: function (data) {
    failure(data.responseJSON.error);
    function ready(){
    getListItemById('http://sp','ListB',2,function(data){
    alert(data.Title);
    function(error){
    console.log(JSON.stringify(error));
    </script>
    <input id="Button1" type="button" value="Run Code"/>
    Thanks,
    Jason
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Jason Guo
    TechNet Community Support

  • How can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,-

    how can i stop an error message that comes up when i am using word? the error message is "word is unable to save the Autorecover file in the location specified. Make sure that you have specified a valid location for Autoreover files in Preferences,…"

    It sounds like if you open Preferences in Word there will be a place where you can specify where to store autorecover files. Right now it sounds like it's pointing to somewhere that doesn't exist.

  • Install error : Please make sure TEMP is set to a valid writable directory

    Hello all.
    When i run ./runInstaller on the command prompt.. i get the error below.
    # ./runInstaller
    Error in writing to directory /tmp. Oracle Universal Installer needs you to have permission in this area to install. Installation cannot continue. Please make sure TEMP is set to a valid writable directory.
    : Permission denied
    Yes i ran the command using oracle user.
    Permissions checked on the partition.
    # ls -ld /tmp
    drwxr-xr-x 3 root root 4096 Dec 11 20:11 /tmp
    Please help, do i need to change the permission for the /tmp partition? if that is the case, what exactly command should i use to change the permission?

    Hi
    Try to do that
    export TEMP=/tmp
    export TMPDIR=/tmp
    export TMP=/tmp
    just to be sure
    Control after that the value is present with env | grep -i temp
    please change also the value to 777 as root.
    Read that for more information : http://download.oracle.com/docs/cd/B19306_01/install.102/b15667/pre_install.htm#CIHFICFD
    especially 2.14 Configuring the oracle User's Environment section 11 and 12.
    Let us know if it helps.
    Thanks.
    Regards,
    Hub

  • How to make multi user drawing application

    how to make multi user drawing application in as 3.0

    I'd suggest using Flash Media Interactive Server if you wish to make this type of application and use Flash as the interface.  I can't give you the details on exactly how to implement it, but using Remote Shared Object and FMIS would serve as the basis.  I believe that the package comes with examples of Shared Objects that can serve as a simple basis from which to proceed.  After that you might want to see if you can find an available whiteboard app that can be leveraged to do as you wish.
    I apologize in advance if using this type of solution is a non-starter, I've been using FMIS locally and have plans to eventually implement something similar to this type of drawing app as well.

  • How to make an user to have right to approve only one specific STS?

    In our BPS STS, we assign user A both on the highest level of one STS hierarchy B and on the lower level of another STS hierarchy C. And because in our real business planning process, A should only have right to approve STS B and can be approved by others in STS C, so we grant authorization "R_STS_SUP" to this user A, but then he has all the authorizations for approving or rejecting plans in both B and C. How to make this user only have authorization to approve STS B? Is there someone can kindly solve this problem? Thank you very much.

    Try to modify tunguska BSP application, OnInitialization handler for page frame.htm contains next code:
      AUTHORITY-CHECK OBJECT 'R_STS_SUP'
               ID 'ACTVT' FIELD '16'.
      IF sy-subrc NE 0.
        application->with_tree = ''.
      ELSE.
        application->with_tree = 'X'.
      ENDIF
    Try to add check for subplan/planning session here and in the case of B and C hierarchy set application->with_tree to blank value.

  • HT4515 How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    How to make sure that after browsing that the webpage is not running in the background, but totally closed down

    Double tap the Home button, tap & hold the Safari icon until it starts to wiggle, tap the red minus sign to remove it from the Multi-Tasking bar. Tap the Home button when finished.

  • I just upgraded to the new 4, but not sure how to make sure all my apps (purchases) get over to the new phone from iphone 3.  can't seem to find instructions. thanks.

    I just upgraded to the new iphone 4, but am hesitant to get it plugged in b/c I don't know how to make sure all the apps purchased on my iphone 3 get to the new phone.  can't seem to find instructions so I'm sure it just "does it", but hesitant to literally pull the plug.  thanks.

    Follow these instructions:  iPhone: Transferring information from your current iPhone to a new iPhone, http://support.apple.com/kb/ht2109

  • How to make the condition type active

    hi,
    how to make the condition type active when its in inactive stage and its showing yellow triangle and y in the control features of it.
    and
    how to solve if is showing a statement as "INITAILISED".
    regards,
    balajit

    Dear Balaji,
    Yes it will come as Inactive mode.....If you make the 2 condition Class is same in single Pricing procedure ,In Standard system will display like this only..
    For Example:PR00-Condition class is Price
    EX00-Condition class is Price
    Then first Condition type will become Inactive.. change the Class of the Second Condition Type.
    Best Regards
    raj.

  • How to make different users to use different Plan_Tables?

    How to make different users to use different Plan_Tables?
    I want each user use his own's Plan_Table. How to achieve this goal?

    qkc wrote:
    How to make different users to use different Plan_Tables?
    I want each user use his own's Plan_Table. How to achieve this goal?Which version of Oracle - if you're on 10g or later you are already (effectively) doing this.
    If not, then copy the 10g strategy back to your version; in outline:
    <ul>
    drop all existing plan tables
    create a table (but call it plan_table$) in the SYS schema (you may prefer to use SYSTEM) as a global temporary table on commit preserve rows
    create a public synonym plan_table for plan_table$
    grant select insert update delete on plan_table to public
    </ul>
    Look in $ORACLE_HOME/rdbms/admin/catplan.sql in a 10g version of Oracle to check how it's done.
    Each user gets a private (temporary) table in their temporary tablespace whenever they use the plan_table
    Their private data disappears when there session ends.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
    There is a +"Preview"+ tab at the top of the text entry panel. Use this to check what your message will look like before you post the message. If it looks a complete mess you're unlikely to get a response. (Click on the +"Plain text"+ tab if you want to edit the text to tidy it up.)
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to draw a perfect circle and how to make sure it is perfectly centered inside a square

    How to draw a perfect circle and how to make sure it is perfectly centered inside a square in Photoshop elements using the Ellipse option.

    1. Create a square canvas.
    2. With the Elipse tool, hold down Shift (Shift forces a circle). Draw the circle anywhere on the canvas (Shape 1 in this example).
    3. Simplify the circle layer
    4. Ctrl-click the layer to select the circle.
    5. Copy the selection to the clipboard (Edit > Copy).
    6. Deselect the selection.
    7. Paste from the clipboard (Edit > Paste). The pasted circle (Layer 1) will be centered.
    8. Delete the original circle layer.
    NOTE: Step 6 is the key. This guarantees that the pasted circle will be centered.
    If you want a circle completely within a square you can simply draw and simplify a circle on any shape canvas. Ctlrl-click the circle to to select it and copy to the clipboard.
    Then do File > New from Clipboard. This creates the circle cropped to a square on transparent background.

  • How to make sure that schema name is not included with generated sqls

    How to make sure that schema name is not included with generated sqls with tableadapter wizard.
    What should I use? Oledb, ODT.NET, where can set that I want "pure" sqls, not schemas, not ", or anything like this
    I want
    "Select a,b from t1" ,not "select "a","b" from schema.t1"
    Also schema name is put in all parameters, all over the place... What if schema name changes. (b1test to b1prod)
    . I now manually edit XML files of dataset. It works but....
    thanks

    The full hardware :
    Processor Intel core due 3.00 MHz
    RAM:1.5GB
    psu:650 Watt (but i baught i cheap one so it may be actually about 400 watt)
    HD Disk:160 GB
    But about the power supply if it not able to run the VGA card ,Is it will not show any screen or it will not able to run the computer??

  • HT200131 how to make sure only my laptop can connect to my apple tv?

    I don't want to see my flatmate apple tv under "connect"
    how to make sure I don't click on his tv accidentally and he won't be able to connect mine?
    thank you!

    Hey J-Justin,
    Great question! You can name your Apple TV to differentiate it from others in the AirPlay list:
    Apple TV: Change the name of your Apple TV - Apple Support
    http://support.apple.com/en-us/HT200028
    Furthermore, you can setup an onscreen code or password to restrict access for AirPlay. The password method sounds like the best option for your setup:
    Apple TV (2nd and 3rd generation): Understanding AirPlay settings - Apple Support
    http://support.apple.com/en-us/HT202618
    Set a password
    Go to Settings > AirPlay > Security > Password > [set password]. You can use this setting to require a password for AirPlay-enabled devices to connect using AirPlay on the Apple TV. Use this setting if your device will need permanent access and you only want to enter the password once.
    Thanks,
    Matt M.

  • Error:Make sure user mapping is correct & all connection properties r right

    Hi,
    I am using SRM 5.0 and EP 7.0 I had imported the verify.der certificate of portal on SRM and changed the profile parameters of SRM to accept tickets.
    And now after creating a system object for Srm on Portal I tried to test the connectivity and it shows the following error.
    "Connection failed. Make sure user mapping is set correctly and all connection properties are correct."
    ANy ideas? Please advice.
    Swetha

    My simple rule is to ignore the message as the test tends to give false negatives. Instead try to access the system with an iView, such as SAP transaction, or use System admin -> support -> SAP application -> scroll down to SAP transaction.
    Cheers

  • SSO- Connection failed. Make sure user mapping is set correctly and all....

    Hi All...
    I configured SSO Between EP6.0 and BW 3.5...By following this tutorial:
    http://help.sap.com/saphelp_nw04/helpdata/en/84/30984076b84063e10000000a1550b0/frameset.htm
    every thing is working fine...  when i trying to check the preview for an iveiw (it is invoking BEx in the BW
    System) it is again asking BW System username & Password. I already done user mapping between the
    portal user with the BW user.
    After i reviewd my entire work i got one problem at:
    System Administration --> System configuration --> Portal content --> opened my created system object ->
    Selected Connection Tests --> Select Connection test for Connectors --> Click on Test Button --> Here i
    got the following error :  Retrieval of default alias successful
                                       Connection failed. Make sure user mapping is set correctly and all connection parameters are correct.
    I checked the usermapping area and connector Parameters those all are correct according to the document.
    I was stuck at this place from 4 days please advice me what are the causes for this error
    Best Regards
    Abhi...

    Have you tested the SSO setting by running the program "RSPOR_SETUP"?
    Yes Rajesh I tested by running the program RSPOR_SETUP in BW System.
    It is saying connection is success to communicate with RFC Server.
    The problem is comming from the portal side when i test connector properties for System object.
    But it is saying WEB AS Connection properties are success for System object.
    The exact Error Message is :
    Connection failed. Make sure user mapping is set correctly and all connection properties are correct.
    Best Regards
    Sudhakar A

Maybe you are looking for

  • Downloads disappear from list immediately and automatically when download completed

    Everytime a download completes it disappears from list automatically

  • Remote for Tv anywhere not working

    My new remote from the box will not work but everything else works fine. Any Ideas how to make my remote work?

  • ATI Radeon Replacement for Probook 4720s

    I believe my video card is malfunctioning. My laptop freezes upon startup.... it use to freeze once in a while whilst gaming or heavy loaded operations. It now freezes before the desktop even loads. It doesn't simply freeze for a few seconds. It will

  • Very large numbers on screen

    The numbers on my phone at times become so large that they won't all fit on the screen.  The only thing I can do is turn it off and back on for them to be a normal size again.  Sometimes it is almost impossible to turn it off because the area you hav

  • UUT flow control in manufactir​ing

    Hello colleagues, I would like to implement a system to control the UUT flow in the manufacturing. I think some companies call it CIM or PCS. For know, what I need is to certify that no untested units will be shipped. In addition, I would like to cer