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 1108449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:05:05+00:00 2026-05-17T02:05:05+00:00

Let me start by saying, I am new to Java programming. I have coded

  • 0

Let me start by saying, I am new to Java programming. I have coded something out that performs in the manner that I want it to. However, it is not very well written.

Here is my code:

import java.lang.Math;

public class Advisor_Score {

    public static void main(String[] args){

        double p1_1[] = {101,1,1,1.5,.5};
        double p1_2[] = {101,2,2.5,2,4};
        double p2_1[] = {102,1,5,5,5,5,5,5,5};
        double p2_2[] = {102,2,2,5,3,4,5,1.5,2.5,5};

        //These arrays represent individual users. The first value in the array is their customer number and the second is domain.
        double All_users[][]={p1_1,p1_2,p2_1,p2_2};

        //This is a 2-dimensional array takes into account all users.

        double[] sum = new double[All_users.length];
        double[] raw_advisor = new double[All_users.length];
        double[] advisor_score = new double[All_users.length];
        for (int i=0;i<All_users.length;i++){
            for(int j=2;j<All_users[i].length;j++){
                    sum[i]+=All_users[i][j];
            }

            raw_advisor[i]=((sum[i]-(3*(All_users[i].length-2)))/4);
            advisor_score[i]= 2.5+(2.5*(1-Math.pow(Math.E, -.5*raw_advisor[i])));
            System.out.print("Customer ID "+All_users[i][0]);
            System.out.print(", Domain "+All_users[i][1]);
            System.out.println(": "+advisor_score[i]);
        }   
    }   
}

However I clearly over rely on the main method. I was wondering if anyone could help me integrate more methods and streamline the whole process. Thanks in advance, I am sorry again. I am new to Java and 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-17T02:05:05+00:00Added an answer on May 17, 2026 at 2:05 am

    Although it may be small, it could be good practice taking a crack at making this more object oriented – here’s a possible start.

    The first thing suggested is from your comment

    // These arrays represent individual users.
    // The first value in the array is their customer number and the second is domain.
    

    You don’t say what the remaining numbers are, but from other comments I gather they are some kind of score. This suggests something like

    public class CustomerDomain
    {
        private int customerNumber;
        private int customerDomainID;
        private List<Double> scores = new ArrayList<Double>();
    
        public CustomerDomain(int number, int domainID)
        {
            this.customerNumber = number;
            this.customerDomainID = domainID;
        }
    
        public void addScore(double score)
        {
            this.scores.add(score);
        }
        public List<Double> getScores()
        {
            return this.scores;
        }
    }
    

    Although in real life I’d probably not have the scores embedded in the customer class.

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

Sidebar

Related Questions

Let me start out by saying that I am new to Java/JSP web development,
Let me just start out by saying I am completely new to Java web
Ok, let me start out by saying that I am brand new to MVC.
Let me start by saying I'm very new to Java and to this site.
Let me start by saying I'm new at programming, mac osx, and bash. I'm
First off, let me start by saying that I am totally new to working
Let me start by saying that I've never coded in Python. I need to
Let me start out by saying that I'm not a C developer and I
Let me start by saying I am new to programming. I am hoping to
Let me start off by saying that I am completely new with WPF (this

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.