Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Please help me complete the calculation WEIGHTED PRODUCT METHOD (MADM).. I just could WP calculation until the value of S, for a SQL query to calculate the value of V ???

  1. #1
    Junior Member
    Join Date
    Jul 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Please help me complete the calculation WEIGHTED PRODUCT METHOD (MADM).. I just could WP calculation until the value of S, for a SQL query to calculate the value of V ???

    double a, b, c, d, e, f, g, h, i, j, k, l, x;
    double k1, k2, k3, k4, k7, k8, bobot1 = 0, bobot2 = 0, bobot3 = 0, bobot4 = 0, bobot7 = 0, bobot8 = 0;
    double hasil;

    a=Double.parseDouble(K1.getText());
    b=Double.parseDouble(K2.getText());
    c=Double.parseDouble(K3.getText());
    d=Double.parseDouble(K4.getText());
    e=Double.parseDouble(K7.getText());
    f=Double.parseDouble(K8.getText());

    String sql="select * from kriteria where id_kriteria='k1'";
    stat=con.createStatement();
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot1= Double.parseDouble(res.getString("bobotWP"));
    }

    sql = "select * from kriteria where id_kriteria='k2'";
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot2= Double.parseDouble(res.getString("bobotWP"));
    }

    sql="select * from kriteria where id_kriteria='k3'";
    stat=con.createStatement();
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot3= Double.parseDouble(res.getString("bobotWP"));
    }

    sql="select * from kriteria where id_kriteria='k4'";
    stat=con.createStatement();
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot4= Double.parseDouble(res.getString("bobotWP"));
    }

    sql="select * from kriteria where id_kriteria='k7'";
    stat=con.createStatement();
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot7= Double.parseDouble(res.getString("bobotWP"));
    }

    sql="select * from kriteria where id_kriteria='k8'";
    stat=con.createStatement();
    res=stat.executeQuery(sql);
    while(res.next()){
    bobot8= Double.parseDouble(res.getString("bobotWP"));
    }

    k1 = (double) (Math.pow(a, bobot1));
    k2 = (double) (Math.pow(b, bobot2));
    k3 = (double) (Math.pow(c, bobot3));
    k4 = (double) (Math.pow(d, bobot4));
    k7 = (double) (Math.pow(e, bobot7));
    k8 = (double) (Math.pow(f, bobot8));
    hasil= (double) (k1*k2*k3*k4*k7*k8);
    nilai.setText(String.valueOf(hasil));


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Please help me complete the calculation WEIGHTED PRODUCT METHOD (MADM).. I just could WP calculation until the value of S, for a SQL query to calculate the value of V ???

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly per the above link.

Similar Threads

  1. simulate calculation ?
    By meryqat in forum Java Theory & Questions
    Replies: 3
    Last Post: April 30th, 2012, 01:03 PM
  2. Method for a table for calculation - help!
    By terripwilliams in forum Loops & Control Statements
    Replies: 1
    Last Post: October 26th, 2011, 11:23 AM
  3. calculate sum and product
    By swampfox in forum What's Wrong With My Code?
    Replies: 6
    Last Post: September 27th, 2011, 03:55 PM
  4. I need calculation
    By Swiss518 in forum Loops & Control Statements
    Replies: 7
    Last Post: January 27th, 2011, 01:26 PM
  5. SQL Time Calculation
    By r12ki in forum JDBC & Databases
    Replies: 3
    Last Post: July 31st, 2009, 03:54 AM

Tags for this Thread