array average across column

array average across column

How can I find the overall averages of the columns in this array? when i run my code it gives me an output that looks like this (showing me wrong averages):

How can I find the overall averages of the columns in this array? when i run my code it gives me an output that looks like this (showing me wrong averages):

0 1 2 3 overall grade Badger,Bradley 37 70 51 48 68.66666666666667 Emu,Emma 35 81 75 40 72.83333333333334 Aardvark,Alice 42 85 22 0 65.11111111111111 Dodo,Donald exc 12 25 0 54.17391304347826 Cassowary,Cassie 50 97 72 68 62.758620689655174

this is my code but i don't know what the mistake is

public static double[] computeAllGrades(int[][] scoreTable, int[] itemPointValues) {

            {
        double totalPoints = 0;
        double totalPointsPossible = 0;
        double allGrades[];
        double grade =0;

        allGrades= new double[scoreTable.length];
        int k = 0;

        for(int j = 0 ; j < scoreTable.length ; j++)
        {
                for(int i = 0 ; i < scoreTable[0].length ; i++)
                {
                        if(scoreTable[j][i] == -1)
                {
                        totalPoints = totalPoints + 0;
                        totalPointsPossible = totalPointsPossible + 0;

                }
                else
                {
                        totalPoints = totalPoints + scoreTable[j][i];
                totalPointsPossible = totalPointsPossible + itemPointValues[i];
                }
                                grade = (totalPoints/totalPointsPossible)*100;

                }

                allGrades[k] = grade;
                k++;
        }


        return allGrades;}}
View Answers









Related Tutorials/Questions & Answers:
array average across column
array average across column  How can I find the overall averages of the columns in this array? when i run my code it gives me an output that looks... of the columns in this array? when i run my code it gives me an output that looks
how to print the average of each column of 2d n*m array using java
how to print the average of each column of 2d n*m array using java  ... the content of file.now i want to calculate mean(average) of each column present...(String[] args) throws IOException { float column[] = new float[4
Advertisements
Average of Array
Average of Array       In this section, we will learn how to get an average of array. For this, first... that calculates the average of array (result/nums.length). And finally it will display
How to calculate average of array in Java?
How to calculate average of array in Java?  Hi, I have an integer array and I want to calculate the average of the values in it. How to calculate average of array in Java? Thanks   Hi, You can iterate through
Read text file to 2D array and sorting the second column
Read text file to 2D array and sorting the second column  we found.... when exams conducted fast 4 times.The first column is the student name and the second column is marks in tests.What we need to find is which student marks
Average
Average   I have created a file that reads in a text file for a combo box which are exams assignments and quizes. I then have a a textfield..., assignments, etc.) so I can have the average of each item. I then need to graph
c++ array find the average mark, highest mark, lowest mark, number of students passing,
c++ array find the average mark, highest mark, lowest mark, number of students passing,    i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array. 01
c++ array find the average mark, highest mark, lowest mark, number of students passing,
c++ array find the average mark, highest mark, lowest mark, number of students passing,    i need help in adding the c++ code for the average mark, highest mark, lowest mark, number of students passing, using array. 01
Maven Repository/Dependency: across | across-hibernate
Maven Repository/Dependency of Group ID across and Artifact ID across-hibernate. Latest version of across:across-hibernate dependencies. # Version Release Date You can read more
ModuleNotFoundError: No module named 'across'
ModuleNotFoundError: No module named 'across'  Hi, My Python... 'across' How to remove the ModuleNotFoundError: No module named 'across'... to install padas library. You can install across python with following command
Student average
to maintain this status is to maintain an average not below 1.8. write a java program... should display the average grade of the student and would display the message...: 1.2 Enter number of units: 1 you got an average of 1.59 congratulation
calculate average
and write a program and calculate your final average in this course. The details
Average Age of my Class?
Average Age of my Class?  average age of my class
in_array
in_array  in_array in php
is _array()
is _array()  is_array() in php   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
is _array()
is _array()  is _array()   Hi Friend, This function is of Boolean type.It checks whether a variable is an array or not. Here is an example: <?php $yes = array('Hello', 'World'); echo is_array($yes) ? 'Array
Maven Repository/Dependency: across-standard-modules | across-hibernate
Maven Repository/Dependency of Group ID across-standard-modules and Artifact ID across-hibernate. Latest version of across-standard-modules:across-hibernate dependencies. # Version Release Date
ModuleNotFoundError: No module named 'average'
ModuleNotFoundError: No module named 'average'  Hi, My Python... 'average' How to remove the ModuleNotFoundError: No module named 'average... to install padas library. You can install average python with following command
sum and average of grades
sum and average of grades  how to print a program which is sum and average of Korean (90), English(85), Mathematics(78), Biology(65), Chemistry(83
Array
Array  how can i use elements of an array in a circular form? that is if the searching of the element reach the last elements of the array, then it will start serching from the begining of the array
Array
Array  is it possible to define array like this..? int[] intArray = new int[] {4,5,6,7,8}; Explain...?   Yes, you can. Java Initialize Array
Array
Array  What if i will not declare the limit index of an array, how will I declare an array and store values with it using loop?   Hi Friend... Scanner(System.in); int array[]=new int[5]; System.out.println("Enter
Hibernate criteria average Example
Hibernate criteria average Example   How to find the average in Hibernate? Thanks   Example of finding average on a filed in Hibernate using criteria. For this you have to use Projections.avg() in your program. Check
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
array
array  write and test a function named mirror that is passed an array of n floats and returns a newly created array that contains those n floats... the array {10.1,11.2,8.3,7.5,22} into{22,7.5,8.3,11.2,10.1
Array
Array  How do i insert elements into an array up to a limit from...("Enter Range: "); int size=input.nextInt(); int array[]=new int[size]; System.out.println("Enter Array Elements: "); for(int i=0;i<
array
array  WAP in java to store 6 element in array P and 4 element in array Q. Produce the third arra y R containing all element from p & q
compute the average of degrees
compute the average of degrees  using c++ language , write a program to do the following 1 enter three degrees of a student by the user . 2 compute the average of his degrees
Array
Array  can we create an array of size 1 lakh in java programming
array
array  array memory allocation is dynamic or static in java   Java Arrays have dynamic memory allocation
How to calculate the average in Hibernate?
How to calculate the average in Hibernate?  Hi, I have to calculate the average in Hibernate. How to calculate the average in Hibernate? Thanks... of calculating the average on the fee field in database: Projections.avg("fee
array
array  create an array in which no element is duplicate. if duplicate then tell to user duplicate. duplicacy is tell to user during when he enter the element
array
array  create an array in which no element is duplicate. if duplicate then tell to user duplicate. duplicacy is tell to user during when he enter the element
array
array  take a 2d array and display all its elements in a matrix fome using only one for loop and ple explain the program in below
array
accepts a pointer to integer which represents an array of integer.After that this method prints the entire of the array numbers to the monitor. include using std::cout; using std::endl; void printArray(int *array, int count
array
array  How to store the results of mysql query in an array... qurey in array: "select distinct(EMPLID)from tblwork where EMPLID not in (select... store the result in array
SQL Average
SQL Average       SQL Average, the part of Aggregate Function. SQL Average is used to compute average value of the records in a table of the database. Understand
array
array  wap to calculate reverse of 10 elements in an array?  ...(); } System.out.print("Array is: "); for(int i=0;i<arr.length;i...(); System.out.print("After reversing, Array is: "); for(int i=arr.length-1;i>=0
Array's
Array's  I have to finish an "order page". that checks 2 dropdown boxes and a set of radio buttons and put the results into a set of textboxes, 1 line at a time, then calculate a total. I know I need to create an array, but I'm
array
array  Hi i have array like {1,2,3,4,,5,5,6,6} then how can i... is an example that store some integers into an array and find the occurrence of each number from the array. import java.util.*; public class SearchNumberOccurrence
array
array  how to getting values and storing values in array by using datainputstream?   Hi Friend, Try the following code:ADS_TO_REPLACE_1...("Array Elements are: "); for(int i=0;i<arr.length;i
Array
reserved. Use a one-dimensional array of primitive type Boolean to represent the seating chart of the cinema theater. Initialize all the elements of the array... the corresponding elements of the array to true to indicate that the seat is no longer
column matrix
column matrix  columan wise total matrix
column matrix
column matrix  columan wise total matrix
Calculate an average Age of my Class?
Calculate an average Age of my Class?  average age of my class
PHP Get Average - PHP
PHP Get Average  I am writing a method to calculate the average rating of the posted answers? can anyone help me with the method to calculate rating in PHP. In my code, we are providing maximum four options to the user to rate
Calculate sum and Average in java
Calculate sum and Average in java  How to calculate sum and average.... Description:- In this example we are calculating sum and average of n numbers... the sum by the total number of numbers, we have determined the average of numbers
Averaging an Array - Java Beginners
the average of an array with the following headers. However, prompt user to enter 10 int and 10 doubles. a) public static int average(int[] array) b) public static double average(double[] array)   Hi Friend, Try the following code
Array Sorter
seperate array the average is found for those numbers...Array Sorter  I need a program that will ask the user to either "Enter an Array" or to "Exit the program" If the user want to enter an array

Ads