Urgent!! PB write a program in C/C++ who start a JVM and invoke a method ja

I try to write a program in C/C++ who start a JVM and invoke a method java.
my program run fine if in my essai method, i do't call the JNI method ierror().
but when i call the ierror() there's a bug :
enter in essai
Exception in thread "Thread-0" java.lang.AbstractMethodError
at prog.Prog.client(Prog.java:12)
what's wrong???
Thanks for your help.
// Prog.java
package prog;
import testnative.jAppEngine;
public class Prog extends jAppEngine
     public void main (String[] args)
     public void essai();
          System.out.println("enter in essai");
          ierror();
          System.out.println("quit essai");
// jAppEngine.java
public class jAppEngine
     public native void ierror();
     static
          System.loadLibrary("jEngine");
// jEngine.cpp (my jEngine.dll)
* Class: testnative_jAppEngine
* Method: ierror
* Signature: ()V
JNIEXPORT void JNICALL Java_testnative_jAppEngine_ierror
(JNIEnv *env, jobject jobj) )
     ierror( "Dans jAppEngine.ierror");
// Application.cpp
JavaVM *vm = 0;
int startJVM( )
char *s = 0;
int ret;
jboolean jvmspecified = JNI_FALSE; /* Assume no option specified. */
char jrepath[MAXPATHLEN], jvmpath[MAXPATHLEN];
int i, knownVMsCount;
/* If we got here, jvmpath has been correctly initialized. */
ifn.CreateJavaVM = 0;
ifn.GetDefaultJavaVMInitArgs = 0;
if (!LoadJavaVM(jvmpath, &ifn))
     return 6;
/* Set default CLASSPATH */
if ((s = getenv("CLASSPATH")) == 0)
          s = ".";
SetClassPath(s);
/* Initialize the virtual machine */
if (!InitializeJVM(&vm, &env, &ifn))
     fprintf(stderr, "Could not create the Java virtual machine.\n");
ret = 1;
return ret;
int LaunchClass( char classname, char jentry, void *p )
int retval;
jclass mainClass;
jmethodID mainID;
JNIEnv *env;
retval = vm->AttachCurrentThread((void **)&env,NULL);
jcls = LoadClass(env, classname);
/* Get the application's main method */
mainID = env->GetMethodID( mainClass, jentry, "()V");
/* Invoke main method. */
env->CallVoidMethod( mainClass, mainID); //, mainArgs);
if ((*vm).DetachCurrentThread() != 0)
     fprintf(stderr, "Could not detach main thread.\n");
return ret;
static void th1(void *p)
     LaunchClass( "prog.Prog", "client", NULL);
     _endthread();
int main(int argc, char* argv[])
     startJVM();
     Beep(6000,500);
     for (int i=0; i<1; i++)
          _beginthread(&th1,0,&i);
          Sleep(500);
     return 0;
}

Hi! bschauwe
Thanks for reply.
My native method called ierror calls effectively a subroutine who's in another dll. I change the name of my native method, no effects always the same error message.
So, in my native method I replace ierror(...) by Beep(..) and it's the same.
I don't understand.

Similar Messages

  • Needed to Write a program dun know how to start  Can anyone suggest

    Objective
    The student will develop classes to implement Dancing
    Turtles using the ACM graphics library.
    Special Requirement
    This assignment uses the acm.graphics package developed by the ACM
    and SIGCSE Java task Force,in particular the turtle graphics class
    GTurtle.
    Running Programs using the Graphics Library
    It turns out that it is easier to run Java Applets using
    the Graphics library that Java applications. There
    is one subtle differences in your code. There is no longer a main()
    method. Instead, your main class
    implements an instance method named run(). The other difference is
    that you choose to run the
    program as an applet. In fact, without the main method, the Run As Java Application menu option
    doesn't even show up.
    Turtle Graphics Background
    Using turtles to create graphics goes back to 1967 with the development
    of the Logo language by Wally
    Feurzeig and Seymour Papert. It uses a set of simple commands to have a
    turtle move around a screen,
    leaving a drawn path in its wake. This simple approach to creating
    graphi
    cs has been repeated in many
    different places, including the ACM graphics library. If you look at
    the GTurtle class in the ACM
    library, you see very intuitive methods like forward() and right(angle).
    Your instructor has put a copy of a simple Simple Turtle Graphics
    program on your course web page.
    The easiest way to run this program is to copy it into an eclipse class of the same name. Then choose
    Run As -> Java Applet.
    Suppose that we would like to model turtles that dance. One kind of
    turtle will move according to adance step pattern that is specified by a sequence of directions in which the turtle is to move. This type
    of turtle is a lead dancer.
    A second kind of turtle is the follower; this turtle will have a reference to
    another turtle and will mimic its moves by moving in the same direction
    on each move. You are to implement these two turtle classes and any other interfaces and classes you need to get the job done.
    TurtleMove class
    Develop a small class named TurtleMove. Each object of type turtle move
    should have two instance
    variables:
    ? a String named action that contains the action ("forward" or "right")
    that the turtle is to do.
    ? a double named arg that contains the argument (if any) for the action.
    The DancingTurtle Interface
    Develop an interface named DancingTurtle that contains declarations
    for the following two
    methods:
    public void move();
    public TurtleMove getMove();
    LeadTurtle
    Develop a class named LeadTurtle. Lead turtles extend GTurtle and
    implement DancingTurtle.
    The LeadTurtle's only constructor takes an array of TurtleMoves as its
    parameter. Each time move() is called, the next move in the array is executed. When the list is exhausted, it starts again at
    the beginning. A call to getMove() returns the next move that is to be
    executed.
    FollowerTurtle
    This type of turtle is assigned another turtle as its "leader" when it
    is constructed (this means that the
    other turtle must exist before this turtle is created). The leader is
    passed as a parameter to the
    constructor. A follower turtle's move() method calls the leader's
    getMove() method to determine
    what to do next. Note that FollowerTurtles also must implement
    getMove(), as a
    FollowerTurtle might be another turtle's leader.
    Write a separate class with a run method to test your code. Your
    instructor will run your test code, but also test your program using his own test driver.
    .

    No one is going to do your work for you. What you need to do is break it down step by step, and implement one feature at a time.
    I would start with the TurtleDancerLead and TurtleDancer, and write down what features each would need, and any common features. When you get some code written and get stuck, post what yo uhave here and ask a specific question, and someone will be gald to help.
    Quite frankly, I'm somewhat amazed at the amount of info provided to you, everything you need is there, I believe.
    ~Tim

  • I want to write ABAP Program in web dynpro Using se80 tra.code

    hi
    I want to write ABAP Program in web dynpro Using se80 tra.code and to Create URL for the same.
    Please let me know the steps to do.
    Thanks

    Hi Shiva,
    I understood ,  you want to create a Webdynpro Applicaiton and run it.
    this will help you
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/cb243c45-0801-0010-eb9c-88669007f130
    Regards
    Abhimanyu

  • What do you use to write Java programs?

    Hi. Do you mind if I ask you what do you use to write your programs in Java? I am a student and we are using NetBeans IDE 3.6. I know it is a bit old but the tutor says we must stick to that one. What is best for writing Java programs?
    Thanks.

    Do you think those things will make things easier or is it more complex?If you're learning on your own, you'd better use something more up to date (most probably better interface, childhood bugs fixed, and better support on the Internet).
    If you're in a classroom, or a training room, you'd better use what the instructor tells, or at least what other students/trainees use. Easier to get help and share tips if everyone has the same setup.
    Good luck learning Java.

  • Trying to write a program that you can enter #s and multiply at the end.

    I' m new to java and trying to write a program
    to choose a number between 1-100
    and another entry choose a number between 2-100
    when numbers are picked then they're multiplyed
    can someone please help me??

    I' m new to java and trying to write a program
    to choose a number between 1-100
    and another entry choose a number between 2-100
    when numbers are picked then they're multiplyed
    can someone please help me??Sure. There are lots of folks around here that would be willing to help you (myself included). What are you having trouble with?

  • Need to write a report to show who is using SAP and to what extent

    Hi Experts,
    I need to write a report which should display who are using SAP and to what extent to forcast future SAP license needs...
    and to ensure the compliance by allocating license types correctly.
    My report should helpfull to organization to reduce the current license requirements and costs.
    Actually my problem is where can i get all these details in SAP, means from which tables.
    in which table can we get the sap user ids using mail id...
    Thanks in advance........
    Ram

    Hi gajeramesh ,
    Goto transaction 'SU10'
    Here you have all the data selection regarding a particular user id, so what you can do is do F1 on any of the fields and see the technical help in that for the table names.
    some of the tables are :
                                     1) 'USUSERS'(User: Transfer structure for lists of users),
                                     2) 'USER_ADDR' (Users by address data)
                                     3) 'USUSERALL' (Users with All Data for List Output)
    I hope this helps you  !!

  • How to write a program to download a table from SAP to Desktop...URGENT

    Hi Gurus,
    I have to write a program that will provide a selection screen thru which u will enter the table  name and then provide options to download that as a excel file or text file or fixed width file...
    Please help me with the code...Its really URGENT...
    Cheers:Sam

    Hey try this code.
    *& Report  ZUS_SDN_RTTI_CREATE_STRUCTUR_2
    *& NOTE: 1st revised version of ZUS_SDN_RTTI_CREATE_STRUCTUR_1
    REPORT  zus_sdn_rtti_create_structur_2.
    TYPE-POOLS: abap.
    DATA:
      celltab          TYPE lvc_t_styl.
    DATA:
      gd_tabnam        TYPE string,
      gd_tabfield      TYPE string,
      go_table         TYPE REF TO cl_salv_table,
      go_sdescr        TYPE REF TO cl_abap_structdescr,
      go_sdescr_new    TYPE REF TO cl_abap_structdescr,
      go_tdescr        TYPE REF TO cl_abap_tabledescr,
      go_typedescr     TYPE REF TO cl_abap_typedescr,
      gdo_data         TYPE REF TO data,
      gdo_handle       TYPE REF TO data,
      gs_component     TYPE abap_compdescr,
      gs_comp          TYPE abap_componentdescr,
      gt_components    TYPE abap_component_tab.
       name       TYPE string,
       type       TYPE REF TO cl_abap_datadescr,
       as_include TYPE abap_bool,
       suffix     TYPE string,
    FIELD-SYMBOLS:
      <gd_fld>            TYPE ANY,  " single field
      <gs_outtab>         TYPE ANY,  " structure with CELLTAB
      <gs_itab>           TYPE ANY,  " structure without CELLTAB
      <gt_itab_pbo>       TYPE STANDARD TABLE,  " without CELLTAB
      <gt_itab_pai>       TYPE STANDARD TABLE,  " without CELLTAB
      <gt_outtab_pbo>     TYPE STANDARD TABLE,  " with CELLTAB
      <gt_outtab_pai>     TYPE STANDARD TABLE.  " with CELLTAB
    PARAMETER:
      p_tabnam      TYPE tabname  DEFAULT 'KNB1'.
    PARAMETERS:
      p_skip        AS CHECKBOX  DEFAULT 'X'.  " skip simulation
    START-OF-SELECTION.
      " Describe structure
      go_sdescr ?= cl_abap_structdescr=>describe_by_name( p_tabnam ).
      gd_tabnam     = go_sdescr->get_relative_name( ).
    Simulate dynamic addition of columns to ALV list
      DO 5 TIMES.
        READ TABLE go_sdescr->components INTO gs_component INDEX syst-index.
        "   Build fieldname
        CONCATENATE gd_tabnam gs_component-name INTO gd_tabfield
                                                SEPARATED BY '-'.
        CLEAR: gs_comp.
        gs_comp-type ?= cl_abap_datadescr=>describe_by_name( gd_tabfield ).
        gs_comp-name  = gs_component-name.
        APPEND gs_comp TO gt_components.
        go_sdescr_new  = cl_abap_structdescr=>create( gt_components ).
        go_tdescr      = cl_abap_tabledescr=>create( go_sdescr_new ).
        "   Create data refence followed by table creation
        CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
        ASSIGN gdo_handle->* TO <gt_outtab_pbo>.
      Dynamic select
        SELECT        * FROM  (p_tabnam) UP TO 10 ROWS
          INTO CORRESPONDING FIELDS OF TABLE <gt_outtab_pbo>
               WHERE  bukrs  = '2000'.
        IF ( p_skip = abap_false ).
          TRY.
              CALL METHOD cl_salv_table=>factory
                IMPORTING
                  r_salv_table = go_table
                CHANGING
                  t_table      = <gt_outtab_pbo>.
              go_table->display( ).
            CATCH cx_salv_msg .
          ENDTRY.
        ENDIF.
      ENDDO.
      TRY.
          CALL METHOD cl_salv_table=>factory
            IMPORTING
              r_salv_table = go_table
            CHANGING
              t_table      = <gt_outtab_pbo>.
          go_table->display( ).
        CATCH cx_salv_msg .
      ENDTRY.
      " Display component list in order to prove that indeed the field names
      " are used (instead of the data element names)
      TRY.
          CALL METHOD cl_salv_table=>factory
            IMPORTING
              r_salv_table = go_table
            CHANGING
              t_table      = gt_components.
          go_table->display( ).
        CATCH cx_salv_msg .
      ENDTRY.
      " Create data reference for structure (without CELLTAB)!!!
      CREATE DATA gdo_handle TYPE HANDLE go_sdescr_new.
      REFRESH: gt_components.
      CLEAR: gs_comp.
      gs_comp-type ?=
            cl_abap_structdescr=>describe_by_data_ref( gdo_handle ).
      gs_comp-name       = 'DATA'.
      gs_comp-as_include = abap_true.
      APPEND gs_comp TO gt_components.
      " Add table type as field to structure ==> complex structure
      CLEAR: gs_comp.
      gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
      gs_comp-name  = 'CELLTAB'.
      APPEND gs_comp TO gt_components.
      go_sdescr  = cl_abap_structdescr=>create( gt_components ).
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_outtab_pbo>.
      Dynamic select
      SELECT        * FROM  (p_tabnam) UP TO 10 ROWS
        INTO CORRESPONDING FIELDS OF TABLE <gt_outtab_pbo>
             WHERE  bukrs  = '2000'.
      PERFORM fill_celltab.
      " Create second itab (PAI data)
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_outtab_pai>.
      <gt_outtab_pai> = <gt_outtab_pbo>.  " PAI data = PBO data
      " Renumbering of customer makes it easier to spot the differences
      LOOP AT <gt_outtab_pai> ASSIGNING <gs_outtab>.
        ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <gs_outtab> TO <gd_fld>.
        <gd_fld> = syst-tabix.  " new numbering of customers
      ENDLOOP.
      LOOP AT <gt_outtab_pbo> ASSIGNING <gs_outtab>.
        ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <gs_outtab> TO <gd_fld>.
        <gd_fld> = syst-tabix.  " new numbering of customers
      ENDLOOP.
      DELETE <gt_outtab_pbo> INDEX 3.  " ==>  3rd row in PAI data is new
      DELETE <gt_outtab_pai> INDEX 7.  " ==>  7th row in PBO data is DELE
      " Shuffle data from outtab to corresponding itab (w/o CELLTAB)
      PERFORM shuffle_outtab_to_itab.
      " List output
      PERFORM write_list.
      EXIT.
      " Simplified version of table creation:
      CLEAR: gdo_data.
      UNASSIGN <gt_outtab_pbo>.
      CREATE DATA gdo_data TYPE STANDARD TABLE OF (p_tabnam).
      ASSIGN gdo_data->* TO <gt_outtab_pbo>.
    END-OF-SELECTION.
    *&      Form  FILL_CELLTAB
          text
    -->  p1        text
    <--  p2        text
    FORM fill_celltab .
    define local data
      DATA:
        ls_cell       TYPE lvc_s_styl,
        lt_celltab    TYPE lvc_t_styl.
      FIELD-SYMBOLS:
        <gs_struc>    TYPE ANY,
        <lt_celltab>  TYPE lvc_t_styl.
      " Create dummy entry for local CELLTAB
      ls_cell-fieldname = 'BUKRS'.
      ls_cell-style     = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_cell INTO TABLE lt_celltab.
      LOOP AT <gt_outtab_pbo> ASSIGNING <gs_struc>.
        ASSIGN COMPONENT 'CELLTAB' OF STRUCTURE <gs_struc> TO <lt_celltab>.
        <lt_celltab> = lt_celltab.
        "   No MODIFY required because we are working with the field symbol
      ENDLOOP.
    ENDFORM.                    " FILL_CELLTAB
    *&      Form  SHUFFLE_OUTTAB_TO_ITAB
          text
    -->  p1        text
    <--  p2        text
    FORM shuffle_outtab_to_itab .
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr_new ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_itab_pbo>.
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr_new ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_itab_pai>.
      LOOP AT <gt_outtab_pbo> ASSIGNING <gs_outtab>.
        ASSIGN COMPONENT 'DATA' OF STRUCTURE <gs_outtab> TO <gs_itab>.
        APPEND <gs_itab> TO <gt_itab_pbo>.
      ENDLOOP.
      LOOP AT <gt_outtab_pai> ASSIGNING <gs_outtab>.
        ASSIGN COMPONENT 'DATA' OF STRUCTURE <gs_outtab> TO <gs_itab>.
        APPEND <gs_itab> TO <gt_itab_pai>.
      ENDLOOP.
    ENDFORM.                    " SHUFFLE_OUTTAB_TO_ITAB
    *&      Form  WRITE_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM write_list .
      WRITE: / 'PBO data:'.
      LOOP AT <gt_itab_pbo> ASSIGNING <gs_itab>.
        WRITE: / 'Record No.=', syst-tabix, '==>'.
        DO.
          ASSIGN COMPONENT syst-index OF STRUCTURE <gs_itab> TO <gd_fld>.
          IF ( syst-subrc NE 0 ).
            EXIT.
          ENDIF.
          WRITE: <gd_fld>.
        ENDDO.
      ENDLOOP.
      SKIP 2.
      WRITE: / 'PAI data:'.
      LOOP AT <gt_itab_pai> ASSIGNING <gs_itab>.
        WRITE: / 'Record No.=', syst-tabix, '==>'.
        DO.
          ASSIGN COMPONENT syst-index OF STRUCTURE <gs_itab> TO <gd_fld>.
          IF ( syst-subrc NE 0 ).
            EXIT.
          ENDIF.
          WRITE: <gd_fld>.
        ENDDO.
      ENDLOOP.
    ENDFORM.                    " WRITE_LIST
    Thaks
    Mahesh

  • How I can write a program with pythagoras?

    I have a problem. I�m a 14-kears old Java-beginner and I�ll write a program for school ( I will get a better mark when i write the program). This programm should multiply 3 letters 30-times. But how I can write the damn thing? I habe no idea, please help me!
    Thnax a lot Devproger
    (Sorry for the bad English but I am a German Student who is still learning this language)

    I will only have a better mark in Maths... and wirte this Programm...Yes, you'll get a better grade by writing that program. Start programming then!
    If you run into problems, post the code that's not working here, and tell us what it is that's not working.
    When posting code, read this: http://forum.java.sun.com/help.jspa?sec=formatting
    Good luck.

  • Help me to write a program?

    hi
    i want to write a program which shows me the latest posts of a special site or shows  posts of specific date, 
    but i don't know how to start it. 
    can you help me,please?
    thanks 

    Hi ,
    We will not support to write a program. If you can't find some similar samples in MSDN develop sample. Please
    submit a sample request to
    https://code.msdn.microsoft.com/windowsapps/site/requests
    Please open new thread for each specific issue. when you
    encountered any develop issue.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • I want to write a program in LabView then pass the test results to teststand to check if it pass or fail without displaying the test stand program,

    I want to write a program in LabView and create an execute but I want to be able to pass test results to test stand to find it the unit pass ar fail the test then save the data to a database. How would i go about it.

    What's confusing is your statement that you want to do this "without display the test stand program". You can minimize the TestStand UI to the task bar but if you don't want TestStand to be running, how can TestStand evaluate the result. Explain a little more please.
    In the message body of your post, you just say you want to create a LabVIEW exe and pass the results to TestStand. What I would recomend is that instead of an exe, you create a dll and use TestStand's DLL adapter to call it and return the results. TestStand will evaluate it and do the logging.

  • Really need help on how to write this program some 1 plz help me out here.

    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    ?Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.?
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)
    For Part 1 this is what i got
    import java.util.Scanner;
    public class Window
         public static void main(String[] args)
              double length, width, glass_cost, perimeter, frame_cost, area, total;
              Scanner keyboard = new Scanner (System.in);
              System.out.println("Enter the length of the window in inches");
              length = keyboard.nextInt();
              System.out.println("Enter the width of the window in inches");
              width = keyboard.nextInt();
              area = length * width;
              glass_cost = area * .5;
              perimeter = 2 * (length + width);
              frame_cost = perimeter * .75;
              total = glass_cost + frame_cost;
                   System.out.println("The Length of the window is " + length + "inches");
                   System.out.println("The Width of the window is " + length + "inches");
                   System.out.println("The total cost of the window is $ " + total);
         Enter the length of the window in inches
         5
         Enter the width of the window in inches
         8
         The Length of the window is 5.0inches
         The Width of the window is 5.0inches
         The total cost of the window is $ 39.5
    Press any key to continue . . .
    Edited by: Adhi on Feb 24, 2008 10:33 AM

    Adhi wrote:
    i am new to java and i confused on how to be writing this program.
    i have completed the Part 1 but i am stuck on Part 2 & 3 so it would would be really great if any 1 could help me out on how to write the program.Looks like homework to me.
    What have you written so far? Post it.
    Part I
    An algorithm describes how a problem is solved in terms of the actions to be executed, and it specifies the order in which the actions should be executed. An algorithm must be detailed enough so that you can "walk" through the algorithm with test data. This means the algorithm must include all the necessary calculations.
    Here is an algorithm that calculates the cost of a rectangular window. The
    total cost of a window is based on two prices; the cost of the glass plus the cost of the metal frame around the glass. The glass is 50 cents per
    square inch (area) and the metal frame is 75 cents per inch (perimeter).
    The length and width of the window will be entered by the user. The
    output of the program should be the length and width (entered by the user)
    and the total cost of the window.
    FORMULAS:
    area = length times width perimeter = 2 times (length plus width)
    Here is the corresponding algorithm:
    read in the length of the window in inches
    read in the width of the window in inches
    compute the area
    compute the cost of the glass (area times 50 cents)
    compute the perimeter
    compute the cost of the frame (perimeter times 75 cents)
    compute the total cost of the window (cost of glass plus cost of frame)
    display the length, width and total cost
    The next step would be to "desk check" the algorithm. First you would need to make up the "test data". For this algorithm, the test data would involve making up a length and a width, and then calculating the cost of the window based on those values. The results are computing by hand or using a calculator. The results of your test data are always calculated before translating your algorithm into a programming language. Here is an example of the test data for the problem given:
    length = 10
    width = 20
    area = 200, glass cost= 100.00 (area times 50 cents)
    perimeter = 60, frame cost = 45.00 (perimeter times 75 cents)
    total cost =145.00
    Once the test data is chosen, you should "walk" through the algorithm using the test data to see if the algorithm produces the same answers that you obtained from your calculations.
    If the results are the same, then you would begin translating your algorithm into a programming language. If the results are not the same, then you would attempt to find out what part of the algorithm is incorrect and correct it. It is also
    necessary to re-check your hand calculations.
    Each time you revise your algorithm, you should walk through it with your test data again. You keep revising your algorithm until it produces the same answers as your test data.
    &#147;Now write and submit a Java program that will calculate the cost of a rectangular window according to the algorithm explained. Be sure to prompt for input and label your output.&#148;
    Part II
    Write, compile and execute a Java program that displays the following prompts:
    Enter an integer.
    Enter a second integer
    Enter a third integer.
    Enter a fourth integer.
    After each prompt is displayed, your program should use the nextint method of the Scanner class to accept a number from the keyboard for the displayed
    prompt. After the fourth integer has been entered, your program should calculate and display the average of the four integers and the value of the first integer entered raised to the power of the second integer entered. The average and result of raising to a power should be included in an appropriate messages
    (labels).
    Sample Test Data:
    Set 1: 100 100 100 100
    Set 2: 100 0 100 0
    Be sure to write an algorithm first before attempting to write the Java code. Walk through your algorithm with test data to be sure it works as anticipated.So this is where you actually have to do something. My guess is that you've done nothing so far.
    Part III
    Repeat Part lI but only calculate the average, not the power. This time, make sure to use the same variable name, number, for each of the four numbers input. Also use the variable sum for the sum of the numbers. (Hint: To do this, you may use the statement sum = sum + number after each number is read.)Man, this specification writes itself. Sit down and start coding.
    One bit of advice: Nobody here takes kindly to lazy, stupid students who are just trying to con somebody into doing their homework for them. If that's you, better have your asbestos underpants on.
    %

  • How to write a program to read any texts in any ABAP program?

    Hi Experts,
    How can I write a program to read specific coding section or any texts in any ABAP program?
    For example, I want to wirte a program to count how many 'LOOP' and 'ENDLOOP' are in any other program.
    Thanks!
    Best regards,
    Hao

    Hi,
    Follow the given below URL for the program to read another Program into an internal Table.
    http://abap4.tripod.com/Upload_and_Download_ABAP_Source_Code.html
    Once the Code is there in the Internal Table , you can do the necessary string search.

  • HOW TO WRITE ABAP PROGRAMMING IN JAVA BY USING NETWEAVER

    HI,
    i am working with bapi(mean is calling bapis in my java programs).
    please tell me the how to write abap programs in nwds
    Thanqqqqqqqqq
    Guru

    Hi,
    Refer the following links..
    http://manuals.sybase.com/onlinebooks/group-iaw/iag0203e/iadgen2/@Generic__BookTextView/24685
    and this blog
    /people/kathirvel.balakrishnan2/blog/2005/07/26/remote-enable-your-rfchosttoip-to-return-host-ip-to-jco
    Regards,
    Uma

  • How to Write C Program in Eclipse

    Hi,
    I write a Java Program in MyEclipse 5.0.in that i wrote System.load("");to load a dll file of C program.But i dont no How to write a C program in Eclipse 5.0 verson.Can any one Pleace Help me to Write a C program in Eclipse 5.0.

    RaghuChowdary_kolikineni wrote:
    I have MyEclipse 5.0 version on my System.i want to write a java Program.in that i want to access the C functionality Using System.load("");so i write another program for C.So i want to write both Java and C programs are Same Eclipse version.how to write and which version is supported for that purpose.pleace spcify the steps to write the programs in that version u will toldTry asking in an Eclipse forum or in a MyEclipse forum.

  • In sap XI when i want to write proxi program it is asking ABAP key...

    Hello all,
            This is sateesh...I had installed sap xi in my own P.C and In sap XI when i want to write proxies program it is asking ABAP key...
            But i am not having the market place i.d...so any one can help me out in solving the problem...
            If any one can give me the access key so that i can access ABAP from the sap xi....
    Thanking all.
    Sateesh.J

    Jakkampudi,
    You need to write the code in the application system ie., in R3 or BW or SRM etc. Also you need to have the developer key access to do it. If you dont have then try to create as a local object so that it will not ask for the key. If it is local object you will not able to transport to QA. But if you are practising you can take this option.
    Regards,
    ---Satish

Maybe you are looking for

  • Linking two work sheets

    Hi All I have two different worksheets namely 'summary' and 'detail'. The purpose is the first worksheet contains the summary report and the second one the detailed report. My problem is both the sheets have a common field on which i linked the sheet

  • Security password

    how to input security key and password for my pdf in android in window vista is no problem can import export password key of pdf but in android i cant do this most pdf bat system and jumpto page auomatic in menu inside of my pdf

  • Printing in black with full cartridge

    The testpage shows black : light grey, dark grey, light grey Some lines are good, other lines half, en some unreadable.  The second page in totaly unreadable

  • I can't download, update or install anything from the MAS

    I recently paid for Mountain Lion from the MAS, but I click download and nothing happens. I left it for five hours, and still the download hasn't even started, or attempted to start. No Error messages have come up. So, I tried downloading a small fre

  • Compatibility BOXI Deski and BO 6.5.

    Hello to all, My client refuses to migrate its BO 6.5 server to a BOXI 3.1 sp3 system. My question coul be strange but it is possible to connect with a BOXI deski to a BO 6.5 repository? Thank you in adavance for you fast answers? Best regards. Julie