Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1059617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:12:03+00:00 2026-05-16T18:12:03+00:00

I am trying to take a two-dimensional array and run it through a series

  • 0

I am trying to take a two-dimensional array and run it through a series of calculations in order to transform it into a one-dimensional array. However, when I run my program I keep getting this long error

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    Duplicate local variable raw_advisor
    Syntax error on token "i", delete this token
    Type mismatch: cannot convert from double to double[]
    Syntax error on token "i", delete this token
    Type mismatch: cannot convert from double to double[]
    Duplicate local variable advisor_score
    Syntax error on token "i", delete this token
    Type mismatch: cannot convert from double to double[]

    at Advisor_Score.main(Advisor_Score.java:16)

Here is what my code looks like:

import java.lang.Math;
public class Advisor_Score {
    public static void main(String[] args){ 
        double l[] = {1};
        double k[] = {2,2};
        double m[] = {3,3,3};
        double All_users[][]={l,k,m};
        double sum[]={0,0,0};
        double [] raw_advisor=new double [3];
        double [] advisor_scored_scaled= new double [3];
        double []advisor_score= new double [3];
        for (int i=0;i<All_users.length;i++){
                for(int j=0;j<All_users[i].length;j++){
                        sum[i]+=All_users[i][j];
                }
                double raw_advisor[i]=(sum[i]-(3*All_users[i].length))/4;
                double advisor_score_scaled[i]= 2.5*(1-Math.pow(Math.E, -.5*raw_advisor[i]));
                double advisor_score[i] = (2.5 + advisor_score_scaled[i]);
                System.out.println(advisor_score[i]);
                }       
    }
}

Thanks in advance! Sorry I am new to programming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:12:04+00:00Added an answer on May 16, 2026 at 6:12 pm

    You can’t specify the type when assigning to the values inside the for loop. In Java, variables are defined once with a specific type. That type can’t be changed later on in the program, so it does not need to be specified. You also had a typo when defining advisor_score_scaled. Try this:

    import java.lang.Math;
    public class Advisor_Score {
        public static void main(String[] args){ 
            double l[] = {1};
            double k[] = {2,2};
            double m[] = {3,3,3};
            double All_users[][]={l,k,m};
            double sum[]={0,0,0};
            double [] raw_advisor=new double [3];
            double [] advisor_score_scaled= new double [3];
            double []advisor_score= new double [3];
            for (int i=0;i<All_users.length;i++){
                    for(int j=0;j<All_users[i].length;j++){
                            sum[i]+=All_users[i][j];
                    }
                    raw_advisor[i]=(sum[i]-(3*All_users[i].length))/4;
                    advisor_score_scaled[i]= 2.5*(1-Math.pow(Math.E, -.5*raw_advisor[i]));
                    advisor_score[i] = (2.5 + advisor_score_scaled[i]);
                    System.out.println(advisor_score[i]);
                    }       
        }
    }
    

    It compiles and runs for me. Not sure of course if it gives the answer you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I am trying to take two arrays and turn them into one 2
trying to take this content: <div class=content>one,two,three</div> <div class=content>four,five,six</div> <div class=content>seven,eight,nine</div> and .split and
I'm trying to take one group and put it in two different columns. I
I am trying to take one form type and display it however times i
I'm trying to take two strings and print them out in alphabetical order. For
I am trying to take a two text areas with multiple emails, one with
In a program that I'm trying to write now I take two columns of
I am trying to take a CSV file as input and transform it into
I am trying to take two numbers and get the square of them. Using
I am trying to write a function in C# that will take two small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.