Loading ...
Sorry, an error occurred while loading the content.

Re: [intellibrain] Re: Having these errors, but it compiles fine in Netbeans

Expand Messages
  • Paul King
    I m not familiar with the syntax A.00 etc. in Java. what is this? Casting to an int will result in overflow for numbers that exceed the size of an int. On
    Message 1 of 4 , Aug 9, 2009
    • 0 Attachment
      I'm not familiar with the syntax "A.00" etc. in Java.  what is this?
       
      Casting to an int will result in overflow for numbers that exceed the size of an int.  On the Intellibrain, an int uses 4 bytes, so your formula would overflow for numbers larger than about 20 million.  long will support larger integer values.
       
      The following statement will round x to two decimal points using only floating point, thus avoiding integer overflow:
          x = Math.floor(x * 100.0 + 0.5) / 100.0;
       
      Paul
       
       
       
      ----- Original Message -----
      From: jujames84
      Sent: Wednesday, August 05, 2009 12:25 PM
      Subject: [intellibrain] Re: Having these errors, but it compiles fine in Netbeans

       

      One more question.... .

      Whats the best way to set a precision for decimal places I realised that import java.text for bigdecimal places not included so i tried

      Example:
      x = (int)((A.00 + B.00 + C.00)*100);
      x = x / 100;

      basically I multiplied it by 100 then casted it into an int then divided by 100 just to get 2 decimal places. That didn't solve the problem bacause when then number started to get larger it didn't show the right result but had an "E1" at the end which i assumed could have been some sort of error....

      I also used Math.round(x) ; but of course that only sets it to be 0 or 1.......etc. ..

      --- In intellibrain@ yahoogroups. com, "David Suarez" <dsuarez1@.. .> wrote:
      >
      > It appears AirConditioner. java does not exist - Robot
      > JDE/RoboJDE/ MobileMeter package
      >
      >
      >
      > Please verify all other java classes exist within the same
      > package(directory)
      >
      >
      >
      > _____
      >
      > From: intellibrain@ yahoogroups. com [mailto:intellibrain@ yahoogroups. com] On
      > Behalf Of jujames84
      > Sent: Tuesday, August 04, 2009 3:25 PM
      > To: intellibrain@ yahoogroups. com
      > Subject: [intellibrain] Having these errors, but it compiles fine in
      > Netbeans
      >
      >
      >
      >
      >
      > It compiles fine in netbeans, but I get these errors with RoboJDE (even when
      > I only point to the file I still get the same errors...
      >
      > [code]
      > Found 16 semantic errors compiling "I:/Senior Project/Sumo11 - Robot
      > JDE/RoboJDE/ MobileMeter/ Main.java" :
      > 48. AirConditioner ac = new AirConditioner( );
      > ^----------- -^
      > *** Semantic Error: Type MobileMeter. AirConditioner was not found.
      > 48. AirConditioner ac = new AirConditioner( );
      > ^----------- -^
      > *** Semantic Error: A candidate for type "AirConditioner" was found, but it
      > is invalid and needs to be fixed before this type will successfully compile.
      > 49. Refrigerator ref = new Refrigerator( );
      > ^----------^
      > *** Semantic Error: Type MobileMeter. Refrigerator was not found.
      > 49. Refrigerator ref = new Refrigerator( );
      > ^----------^
      > *** Semantic Error: A candidate for type "Refrigerator" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 50. Washer wash = new Washer();
      > ^----^
      > *** Semantic Error: Type MobileMeter. Washer was not found.
      > 50. Washer wash = new Washer();
      > ^----^
      > *** Semantic Error: A candidate for type "Washer" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 51. Dryer dry = new Dryer();
      > ^---^
      > *** Semantic Error: Type MobileMeter. Dryer was not found.
      > 51. Dryer dry = new Dryer();
      > ^---^
      > *** Semantic Error: A candidate for type "Dryer" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 52. Lights lights = new Lights();
      > ^----^
      > *** Semantic Error: Type MobileMeter. Lights was not found.
      > 52. Lights lights = new Lights();
      > ^----^
      > *** Semantic Error: A candidate for type "Lights" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 63. Counter acCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: Type MobileMeter. Counter was not found.
      > 63. Counter acCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: A candidate for type "Counter" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 64. Counter refCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: A candidate for type "Counter" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 65. Counter washCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: A candidate for type "Counter" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 66. Counter dryCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: A candidate for type "Counter" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > 67. Counter lightsCounter = new Counter(0);
      > ^-----^
      > *** Semantic Error: A candidate for type "Counter" was found, but it is
      > invalid and needs to be fixed before this type will successfully compile.
      > Compilation failed
      > [/code]
      >
      > I can submit my code.... (all those are declares as separate classes in the
      > same folder....
      >

    Your message has been successfully submitted and would be delivered to recipients shortly.