Help with number

I want to check for numbers in a "IF statement". Say if I got 0-10000 as a value, I want to only check for value between 1000-10000.

Ok, thanks, but how can I add a letter "G" to check in a "IF stament"?
I cant write this:
if(NewValue < G50)
So how can I fix it in this:
public var NewValue:Object;
public var Value:String;
var Value:String = event.data.readUTFBytes(event.data.bytesAvailable);
            if(Value)
     NewValue = Value;   
     if(NewValue < 50)
      Battery.setStyle("chromeColor", "red");
     else     
      Battery.setStyle("chromeColor", "green");      

Similar Messages

  • Need help with " Number guessing game " please?

    This is what teacher requires us to do for this assignment:
    Write a program that plays a simple number guessing game. In this game the user will think of a number and the program will do the guessing. After each guess from the program, the user will either indicate that the guess is correct (by typing �c�), or that the next guess should be higher (by typing �h�), or that it should be lower (by typing �l�). Here is a sample output for a game. In this particular game the user thinks of the number 30:
    $java GuessingGameProgram
    Guess a number between 0 and 100
    Is it 50? (h/l/c): l
    Is it 25? (h/l/c): h
    Is it 37? (h/l/c): l
    Is it 31? (h/l/c): l
    Is it 28? (h/l/c): h
    Is it 29? (h/l/c): h
    Is it 30? (h/l/c): c
    Thank you for playing.
    $
    This program is implementing a binary search algorithm, dividing the range of possible values in half with each guess. You can implement any algorithm that you want, but, all things being equal, binary search is the best algorithm.
    Write the program so that the functionality is split between two classes: GuessingGameProgram, and NumberGuesser.
    GuessingGameProgram will only be used for its main function. It should instantiate a NumberGuesser, and it will be responsible for the loop that notifies the user of the next guess, reads the �h�, �l�, or �c� from the user, and sends an appropriate message to the number guesser accordingly.
    The guesses themselves should all be generated by the NumberGuesser class. Here is a diagram of the members and methods for the class. Notice that the members are unspecified. Feel free to give your NumberGuesser class any members (which we have also been calling fields, or instance variables) that you find useful. Make them all private.
    NumberGuesser
    NumberGuesser(int upperLimit, int lowerLimit)
    int guess()
    void higher()
    void lower()
    The constructor should take two integer arguments, a lower and upper bound for the guesses. In your program the constructor will be called with bounds of 0 and 100.
    The guess method should return the same value if it is called more than once without intervening calls to the lower or higher methods. The class should only change its guess when it receives a message indicating that its next guess should be higher or lower.
    Enjoy. Focus your attention on the NumberGuesser class. It is more interesting than the GuessingGameProgram class because it is a general-purpose class, potentially useful to anybody who is writing a number guessing game. Imagine, for instance, that a few weeks from now you are asked to write a number guessing game with a graphical Java Applet front end. If you NumberGuesser class is well written, you may be able to reuse it without any modifications.
    I'm new to JAVA and I'm set with my 2nd homework where I'm so confused. I know how to do something of this source in C language, but I'm a bit confused with Java. This is the code me and my classmate worked on, I know it's not 100% of what teacher asked, but is there any way possibly you guys could help me? I wrote this program if the game is played less then 10 times, thought I would then re-create a program without it, but now I'm confused, and my class book has nothing about this :( and I'm so confused and lost, can you please help? And out teacher told us that it's due the end of this week :( wish I knew what to do. Thank you so so much.
    Here's the code:
    import java.text.*;
    import java.io.*;
    class GuessingGame
    public static void main( String[] args ) throws IOException
    BufferedReader stdin = new BufferedReader(new InputStreamReader( System.in ) );
    int guess = 0, limit = 9, x = 0, n, a = 0 ;
    double val = 0 ;
    String inputData;
    for ( x = 1; x <= 10; x++)      //number of games played
    System.out.println("round " + x + ":");
    System.out.println(" ");
    System.out.println("I am thinking of a number from 1 to 10. ");
    System.out.println("You must guess what it is in three tries. ");
    System.out.println("Enter a guess: ");
    inputData = stdin.readLine();
    guess = Integer.parseInt( inputData );
    val = Math.random() * 10 % limit + 1;     //max limit is set to 9
    NumberFormat nf = NumberFormat.getNumberInstance();
    nf.setMaximumFractionDigits(0);               //format number of decimal places
    String s = nf.format(val);
    val = Integer.parseInt( s );
         for ( n = 1; n <= 3; n++ )      //number of guess's made
                   if ( guess == val)
                        System.out.println("RIGHT!!");                    //if guess is right
                        a = a + 1;
                        System.out.println("You have won " + a + " out of " + x + " rounds");
    System.out.println(" ");
    n = 3;
    continue;
              if (n == 3 && guess != val)                         //3 guesses and guess is wromg
                        System.out.println("wrong");
    System.out.println("The correct number was " + val);
                        System.out.println("You have won " + a + " out of " + x + " rounds");
    System.out.println(" ");
    continue;
                   //how close guess is to value
                   if ( guess == val - 1 || val + 1 == guess) //Within 1
                   System.out.println("hot");
         else if ( guess == val - 2 || val + 2 == guess) // Within 2
                   System.out.println("warm");
              else
                   System.out.println("cold");                         // Greater than 3
         inputData = stdin.readLine();
         guess = Integer.parseInt( inputData );
    //ratings
    if ( a <= 7)
         System.out.println("Your rating is: imbecile.");
    else if ( a <= 8)
         System.out.println("Your rating is: getting better but, dumb.");
    else if (a <= 9)
         System.out.println("Your rating is: high school grad.");
    else if ( a == 10)
         System.out.println("Your rating is: College Grad.!!!");

    Try this.
    By saying that, I expect you ,and your classmate(s), to study this example and then write your own. Hand it in as-is and you'll be rumbled as a homework-cheat in about 20ms ;)
    When you have an attempt where you can explain, without refering to notes, every single line, you've cracked it.
    Also (hint) comment your version well so your tutor is left with the impression you know what you're doing.
    In addition (huge hint) do not leave the static inner class 'NumberGuesser' where it is. Read your course notes and find out where distinct classes should go.
    BTW - Ever wonder if course tutors scan this forum for students looking for help and/or cheating?
    It's a double edged sword for you newbies. If you ask a sensible, well researched question, get helpful answers and apply them to your coursework, IMHO you should get credit for doing that.
    On the other hand, if you simply post your assignment and sit there hoping some sucker like me will do it for you, you should be taken aside and given a good kicking - or whatever modern educational establishments consider appropriate abmonishment ;)
    I'd say this posting is, currently, slap bang between the two extreemes, so impress us. Post your solution in the form you intend to hand it in, and have us comment on it.
    Good luck!
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    public class GuessingGame
         public static void main(String[] args)
              throws Exception
              BufferedReader reader= new BufferedReader(
                   new InputStreamReader(System.in));
              NumberGuesser guesser= new NumberGuesser(0, 100);
              System.out.println(
                   "\nThink of a number between 0 and 100, oh wise one...");
              int guess= 0;
              while (true) {
                   guess= guesser.guess();
                   System.out.print("\nIs it " +guesser.guess() +"? (h/l/c) ");
                   String line= reader.readLine();
                   if (line == null) {
                        System.out.println(
                             "\n\nLeaving? So soon? But we didn't finish the game!");
                        break;
                   if (line.length() < 1) {
                        System.out.println("\nPress a key, you muppet!");
                        continue;
                   switch (line.toLowerCase().charAt(0)) {
                        case 'h':  
                             guesser.higher();
                             break;
                        case 'l':     
                             guesser.lower();
                             break;
                        case 'c':
                             System.out.println("\nThank you for playing.");
                             System.exit(0);
                        default:
                             System.out.println(
                                  "\nHow hard can it be? Just press 'h' 'l' or 'c', ok?");
                             continue;
                   if (guess == guesser.guess()) {
                        System.out.println(
                             "\nIf you're going to cheat, I'm not playing!");
                        break;
         private static class NumberGuesser
              private int mLower;
              private int mUpper;
              private int mGuess;
              NumberGuesser(int lowerLimit, int upperLimit)
                   mLower= lowerLimit;
                   mUpper= upperLimit;
                   makeGuess();
              private void makeGuess() {
                   mGuess= mLower + ((mUpper - mLower) / 2);
              int guess() {
                   return mGuess;
              void higher()
                   mLower= mGuess;
                   makeGuess();
              void lower()
                   mUpper= mGuess;
                   makeGuess();
    }                  

  • Help with number counting project

    the program is supposed to let the user enter numbers and and then return the numbers they entered and how many times they entered each one. this is what i have so far and i dont know what i need to put next so can anybody give me a hint or help me please thanks
    * Joey McCashland
    * 02/04/08
    * CS3 AP
    * PP 6.1
    import java.util.*;
    public class PP6_1
        public static void main()
            ArrayList dean = new ArrayList();
            Scanner s = new Scanner (System.in);
            int num = 0;
            while(( num <= 50) && (num >= 0 ));
            System.out.println("Enter any integers from 0 to 50. Enter -1 to stop");
            num = s.nextInt();
            dean.add(num);
            System.out.println(num);
    }

    Edited by: Encephalopathic on Feb 17, 2008 6:02 PM

  • Help with Number IF function

    I wanted to create a sales spreadsheet where if a goal was met the cell would change color but I'm working with percentages.
    Example:
    If the value in cell A is greater than or equal to 35% of the value of cell B then true and the cell is green. if False it turns red.
    is something like this possible?

    Hi Vale,
    The only way I know to do something like this with conditional highlighting is to add a column that will agree with your target when the conditions are met.
    The highlighting rule will turn the cell green when C1=A1. C can be hidden. The normal fill for the cell is red.
    quinn

  • Help with number in hidden variable to send form

    Hi all,
    I have created a form in Flash and I need to send some hidden data. The problem is that some of the hidden data variables are numbers. This worked fine in the HTML form. It does not work in Flash. Can you take a quick look at the following code and let me know if there is a way I can do this? The variables that are numbers are commented out at this point because it throws up errors. I would like to be able to uncomment them but if I do nothing works.
    send_btn.onRelease = function()
        var my_lv:LoadVars = new LoadVars();
        //OLP HIDDEN VARIABLES
        //my_lv.retURL = "http:///";
        my_lv.debug = "5";
        my_lv.debugEmail = "[email protected]";
        my_lv.campaign_id = "5";
        // <!-- SFDC client ID -->
        my_lv.oid = "00M0022000jZDG";
        // <!-- Promotion code -->
        //my_lv.00P32220104Yrhq = "10Q4MACQ-MidMarket";
        // <!--Lead source:-->
        my_lv.lead_source = "Inbound Webform LP";
        // <!--Campaign tracking code:-->
        //my_lv.00F312230004Yr6w = "10Q4MACQ-MidMarket";
        my_lv.Campaign_ID = "70130000000LKal";
        // <!-- Key Code -->
        //my_lv.00N312330004Ys1x = "";
        // <!--Lead type:-->
        my_lv.lead_type = "other";
        //my_lv.00R30012314004Yr5F = "other";
        // <!--Tactic:-->
        //my_lv.00P301231404Ys1s = "Bundle Builder";
        my_lv.member_status = "responded";
        my_lv.successURL = "???";
        //OLP VARIABLES
        my_lv.first_name = "";
        my_lv.last_name = "";
        my_lv.email = "";
        my_lv.company = "";
        my_lv.title = "";
        my_lv.street = "";
        my_lv.city = "";
        my_lv.state = "";
        my_lv.zip = "";
        my_lv.phone = "";
        my_lv.industry = "";
        my_lv.employees = "";
        //The exact link here has been taken out for security reasons.
        my_lv.send("https://www.salesforce.com","_self","POST");

    Do you have access to / knowledge of the file that processes the data that gets sent.  Yo may have to add some code at the receiving end to take those variables you send and assign them to what would normally accomodate them at the receiving end.
    (Sorry if I confused your original description and stated what was already obvious to you.)

  • Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be ab

    Hi, please help with the installation of Lightroom 4, I bought a new Mac (Apple) and I want to install a software that I have on the album cd. My new computer does not have the drives. Can I download software from Adobe? Is my license number just to be able to download the srtony adobe.

    Adobe - Lightroom : For Macintosh
    Hal

  • I need help with my serial number.  I downloaded soundbooth cs3 to restore my downloaded puchase, but my serial number is not being accepted.  I have 16 more days to resolve this.

    I need help with my serial number.  I downloaded soundbooth cs3 to restore my downloaded purchase, but my serial number is not being accepted.  I have 16 more days to resolve this.  I don't need tech support, I just need the software I purchased to work for me.  That's not to much to ask, is it?  Can anyone from adobe help me please?
    Chris

    Error "The serial number is not valid for this product" | Creative Suite

  • I cannot download updates to Photoshop Elements 9.  I get an error message that my serial number is not recognized or eligible.  Can you help with this?

    I cannot download updates to Photoshop Elements 9.  I get an error message that my serial number is not recognized or eligible.  Can you help with this?

    Hi,
    Which operating system are you running on?
    What updates are you trying to download?
    The last update was 9.0.3 - check by loading the editor and going to Help -> About Photoshop Elements
    The last supported Camera raw is ACR 6.5 - check by loading the editor and going to Help -> About Plug-ins -> Camera Raw
    Do you have a reason to update?
    Brian

  • What's the phone number I should call for help with my iPhone and ihome dock?

    What's the phone number I should call for help with my iPhone and ihome dock?

    http://www.ihomeaudio.com/support/

  • Is there a phone number I can call to talk to a live person about help with Lightroom issues ?

    Is there a phone number I can call to talk to a live person about help with Lightroom issues ?

    well the reason I wanted to talk to someone live because it would take forever to explain everything on here But anyway, here goes. I have an HP Pavilion Notebook with Intel Core i5-323om CPU @2.60 GHz and 8 gb ram 64bit. I am trying to run Lightroom 5.7 on my laptop and having major issues. I use an external hard drive for the storage of my photos. When I try to use Lightroom I run into many issues: Flickering of the screen, freezing up, slow, the loading circle just goes round and round lol. If I go to the washroom or leave the computer for even a minute it freezes up. I have to keep pressing Ctr/alt/delete to bring it back when it flickers. I have to constantly exit out of the program and restart it to be able to edit even just a couple of photos and then it starts acting up again.
    I have tried un-installing and re-installing, updating everything on my pc, changing compatibility settings, updating development settings, I even took the laptop into have it looked at and they did all kinds of updates etc...and still couldn't figure out why it wasn't working for me. I have gone through the lists of troubleshooting for LR problems and there just seem to be nothing that works.....I have made new catalogues, moved them, tried using the software on my pc without the EHD, etc etc.......I have tried EVERYTHING...I think.....so I was looking for some answers as to why this is happening....

  • Anyone help with linking a bank account to your apple id. The form wants a phone number I only have a UK mobile number and it doesnt sem to want to accept it keeps l;ooping me back to entering a phone number.

    Anyone help with linking a bank account to your apple id. The form wants a phone number I only have a UK mobile number and it doesnt sem to want to accept it keeps l;ooping me back to entering a phone number.

    If you are trying to setup a charge card number on the Apple Store - make sure you are in the Correct country site - icon bottom right last time I saw it - where you can change country.  

  • I need help with my new LG G2. I dial *611 but it will not recognize my phone number

    I am having trouble setting up my new LG G2. When I dial *611, it will not recognize my number, and the 800 number refers me back to the *611 number. There is no live chat available on the website, so I am lost. Is this any way to run customer support?

    It seems I am about the only G2 customer support you'll fund unfortunately.  Chat is available on the support site after logging in to My Verizon on the web, but you have to click on Contact Us at the top right of the page then choose Live Chat and then Help with My device and then look to the right and wait for the red dot to turn green.  *611 will take you to a screen where you can launch My Verizon or Click to Call which dials the customer support number. Unfortunately chat is about as useless as waiting for a rep to respond in the forums.  Calling is the only way to get started and work your way up the chain.  Going to a store is a hassle.  What exactly is the problem you're having?  You can't activate the phone or set up your Google accounts or what?

  • I have a 19 digit Adobe Photoshop Elements 12 Serial number.  It should be 24.  Any help with this?

    I have a 19 digit Adobe Photoshop Elements 12 Serial number.  It should be 24.  Any help with this?

    Where are you looking for the serial number?
    If you have the disks, the number commencing 1057 is usually inside the packaging. It’s necessary to pull out the white inner box.
    If you purchased this some while ago and the product, the serial number should be in your Adobe account. Click on the red Adobe logo (top left on this web page) sign-in with your Adobe ID (email & password) and choose Manage Account. You should be able to browse your purchase history and registered products.

  • There are 6 updates to be made with my system and they start but after downloading and rebooting it always says that non could be installt because of an mistake, but no help, no number, no possibility to chose from...

    there are 6 updates to be made with my system and they start but after downloading and rebooting it always says that non could be installt because of an mistake, but no help, no number, no possibility to chose from...

    Do you get an error number? What is the exact message?
    Two things to try.
    - Sign out of the App Store (in the Store menu)
    - Quit the App Store
    - In Finder - Go>Go to folder...  (or Apple-shift-G)
    - Paste in the following "~/Library/Caches/ "
    - It will take you to a folder.  Delete com.apple.appstore
    - Launch the App Store.
    If that doesn't work, try an App Store reset and then try again.
    App Store Reset       Learned from Old Toad
    There is a contact link.
    App Store Support

Maybe you are looking for

  • Early 2011 15-inch MacBook pro running a tad bit slow

    Had it for a while now and he's been treating me well, but all of a sudden the performance has started going a little wonky. Sometimes when I'm working, it'll just go black-screen (and stop playing music if I was playing any before) and then the logi

  • Windows Vista can't log onto wifi network with Airport Extreme

    Several problems with our network. 1. My sister's new Gateway laptop sees the network I set up from my Mac using my airport extreme, but cannot log on to it even when I removed password/encryption - even when I entered 4.2.2.1 and 4.2.2.2 in my DNS s

  • IMessage wasn't working so it send as a regular text. Now all texts to that person is a regular text.

    Last night, after I got off work, which I always keep my phone on airplane mode while I'm working, I went to send a text to one friend. My phone wouldn't send it through as an iMessage so it gave me the option to send as a SMS text. I chose to send i

  • Computer not recognizing itunes 7.0 download

    After receiving thank you for downloading itunes 7.0 message,for some reason my computer is not recognizing the download and I am in a loop of downloading and thankyou for downloading messages....what gives? How do i launch itunes 7.0 after it has be

  • IPad2 connects at home, not at work

    OK, this is a strange one. We have several users, both Mac and PC using iPad2's as part of our testing before we make them available for anyone to use. One user is having issues when she tries to sync at work. When she takes her work laptop home and