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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:14:56+00:00 2026-05-16T21:14:56+00:00

So I would like to start out by telling you that I am learning

  • 0

So I would like to start out by telling you that I am learning Java on my own and you guys are the nearest thing I have to teachers. So thank you so much for putting up with my simple and obvious question. I am just trying to learn. Once again I am getting an error that for the life of me I cannot figure out.

Here is the error:

Exception in thread "main" java.lang.NullPointerException
at Advisor_score.All_user.Score1(All_user.java:13)
at Advisor_score.All_user.main(All_user.java:28)

Here is my code for the ratings class:

package Advisor_score;
public class Rating {
    double [] Ratings;
    double sum=0;
    double raw_advisor;
    double advisor_score;
public Rating (double [] x){
        Ratings = x;
        }

public double Score(){
for(int i=2;i<Ratings.length;i++){
    sum+=Ratings[i];
}
raw_advisor=((sum-(3*(Ratings.length-2)))/4);
advisor_score= 2.5+(2.5*(1-Math.pow(Math.E, -.5*raw_advisor)));
return advisor_score;
}

Here is my code for the other class:

package Advisor_score;      

public class All_user{
        double [] ADVISOR_SCORE;
        Rating [] All_users;
        double score;
        public All_user(Rating...args){
                All_users=args;
            }

        public double [] Score1(){
            for (int j = 0;j<All_users.length;j++){
                score=All_users[j].Score();
                ADVISOR_SCORE[j]=score;
                }
            return ADVISOR_SCORE;
        }
        public void print(){
            for(int i = 0;i<ADVISOR_SCORE.length;i++){
            System.out.println(ADVISOR_SCORE[i]);
            }
        }
        public static void main(String[] args){ 
            double p1_1[] = {101,1,5,5,5};
            double p2_1[] = {101,1,1,2,3};
            Rating d = new Rating(p1_1);
            Rating e = new Rating(p2_1);
            All_user all=new All_user(d, e);
            all.Score1();
            all.print();
        }

    }

Again, I cannot thank you guys enough at StackOverflow. Your help has been invaluable!!

  • 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-16T21:14:57+00:00Added an answer on May 16, 2026 at 9:14 pm

    You have not initialized the ADVISOR_SCORE and All_users arrays, but you do try to assign values and use them. When you declare

    double[] ADVISOR_SCORE; // this is null until assigned
    

    At some point, it needs to be assigned

    ADVISOR_SCORE = new double[size];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object animating, which I would like to start fading out, after
I would like to start a personal project that will give me a lot
I would like to start a broadcast receiver from an activity. I have a
I have a multipage reporting services report, and i would like to start from
I have a simple Clock Applet that I would like to be able to
I have a program that relates to a database. I start out my program
First off, before I ask, i would like to point out that this question
First, I'd like to start out expressing that I am not trying to just
I have a large (100+ tables) SQL Server 2005 database that I would like
How can I find out, whether the model has changed? I would like start

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.