Help me making this simple calculation in my extension

    public double Add (int x) { 
    return x + 273.14; 

    }

like this?

1 Like

Yes same like this is it worked?

1 Like

Yes, but you could set the x variable type to double too.:slightly_smiling_face:.

1 Like

hello @Mohamed_Tamer, @iamwsumit, @Srrazmi, @golumaths100
i have little added more codes to my project but i got the following error -

Buildfile: /projects/goldv2/appinventor-sources/appinventor/build.xml

extensions:

clean:

init:

common_CommonUtils:

init:

CommonUtils:

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

CopyToRunLibDir:

components_AndroidRuntime:

init:

CommonConstants:
    [javac] Compiling 6 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/CommonConstants
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

HtmlEntities:
    [javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Temperature_Converter/Temperature_Converter.java:64: error: reached end of file while parsing
    [javac] }
    [javac]  ^
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 2 seconds
dir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
    [javac] Compiling 1 source file to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/HtmlEntities
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] 1 warning
      [jar] Building jar: /projects/goldv2/appinventor-sources/appinventor/components/build/HtmlEntities.jar

common_CommonVersion:

init:

CommonVersion:
     [exec] Result: 128
     [exec] Result: 128

AndroidRuntime:
    [mkdir] Created dir: /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] Compiling 332 source files to /projects/goldv2/appinventor-sources/appinventor/components/build/classes/AndroidRuntime
    [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
    [javac] /projects/goldv2/appinventor-sources/appinventor/components/src/com/appybuilder/contact2niraj/Temperature_Converter/Temperature_Converter.java:64: error: reached end of file while parsing
    [javac] }
    [javac]  ^
    [javac] 1 error
    [javac] 1 warning

BUILD FAILED
/projects/goldv2/appinventor-sources/appinventor/build.xml:35: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:372: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/components/build.xml:141: The following error occurred while executing this line:
/projects/goldv2/appinventor-sources/appinventor/build-common.xml:118: Compile failed; see the compiler error output for details.

Total time: 3 seconds

Show your code, either you are missing a } mistakenly closed your class before your code ends.
P.S: is line 64 is the last line in your code?

sorry i missed it at end

1 Like

no it is not

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.