Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem comes in your <code>All_user</code> class constructor; you're trying to set... something... of type <code>Ratings[]</code> to a class member of type <code>double[]</code></p> <p>You could do one of the following :</p> <p>1- Have your <code>All_user</code>'s constructor receive an array (or variable-length arguments) be instances of <code>Rating</code> and simply assign it to the class member (an array) of the same type :</p> <pre><code>public class All_user{ Rating [] All_users; public All_user(Rating...argument) { All_users = argument; // arguments is a Rating[] } } </code></pre> <p>or collect all values (<code>double Ratings</code>) from each <code>Rating</code> and map them into an array</p> <pre><code>public class All_user{ double [] All_users; public All_user(Rating...argument) { ArrayList&lt;Double&gt; ratings = new ArrayList&lt;Double&gt;(); for (Rating r : argument) { for (double d : r.Ratings) ratings.add(d); } All_users = new double[ratings.size()]; for (int i=0; i&lt;ratings.size(); i++) All_users[i] = ratings.get(i); } } </code></pre> <p>I think the latter is what you are trying to do. Also, note that your <code>Rating</code> class could also be rewritten as </p> <pre><code>public class Rating{ double [] Ratings; int CustomerID; int Domain; public Rating (int id, int d, double...x) { double [] Ratings = x; int CustomerID=id; int Domain=d; } } </code></pre> <p>FYI: The variable-length argument is always the last one in the declared arguments. More on varargs <a href="http://download.oracle.com/javase/1.5.0/docs/guide/language/varargs.html" rel="nofollow noreferrer">here</a> and <a href="https://stackoverflow.com/questions/766559/when-do-you-use-varargs-in-java">here</a>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload