Purchase Solution

Example of an array in java

Not what you're looking for?

Ask Custom Question

Write all the code for a class called ArrayQsn. This class will contain two methods. The first method runningSumMean accepts an array of ints as a parameter, and will return the mean of the values as a double. It also changes the values of the array so that they are running sum values.
For example, the array:
{2, 4, 5, 1, 3}
Would become:
{2, 6, 11, 12, 15}
after the method is called. Do not write more than one loop inside the method. Your method must accept any size array.
If the array is empty (no values), then provide an error message to the screen and return zero.
The second method is the "main" method. Use it to test the runningSumMean method with the array given above. The main method must provide output to the screen that would look like:

Mean = 3
Array: 2, 6, 11, 12, 15

Purchase this Solution

Solution Summary

Example of an array in java is provided.

Solution Preview

public class ArrayQsn {public static double runningSumMean (int[] anArray) {
if (anArray == null) {System.out.println ("Warning, empty array!");
return 0;}
if ...

Purchase this Solution


Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.