Computer problems,Computer help
*AX SOFT>>>Programming & Design

Need help with Java programming (involving arrays)?


I need to find a code that will allow me to compute averages using arrays. Does anyone know where I can find this?

Just write one yourself. It's easy.

// array1 is already defined
double total = 0;
for( int i=0; i < array1.length; i++){
total+=array[i];
}
double avg = total/array1.length;

Tags
  General - Computers & Internet   Software   Security   Programming & Design   Facebook   Flickr   Google   MSN   MySpace
Related information
  • Trying to understand a piece of code in VBA [excel]?

    Sub Processor() ->Beginning of subroutine:Processor Dim ConstantCells As Range ->Define ConstantCells as a range of cells Dim FormulaCells As Range ->like above statement Dim cell As...

  • How do I keep a running total score in c++?

    Set the value to 0 above the loop and add to the value test = 0; loop{ score = 15; test+=score; } cout << test

    ...
  • Use ASP .NET's membership system or roll your own?

    Well the pro's are pretty obvious. It offers you a ready component for use to save/retrieve users for your website, it integrates pretty well very easily with Login server controls thus saving...

  • Is there an equivalent for the GetChar() function from VB.Net in VB6?

    Have you tried Mid(String,Index,Length)? MyString = "HELLO!" Print Mid(MyString,2,1) Would print "E"

    ...
  • ASCII/ANSI Character codes?

    You need to look at unicode, ASCII only covers the 256 characters, Unicode however uses 4 Bytes (32 bits) to store the character information (as opposed to two) and so can store mush more. As fo...

  • Sending POST Using <a href=...> instead of the submit button?

    What about using JavaScript to submit hidden forms when the link is clicked? :) For instance.. <form action="post.php" id="frm" method="post" style="displa...

  • In JSP I want to print out my database entries with the newest first?

    Order them in the DB query. Instead of SELECT * FROM ARTICLE Use something like SELECT * FROM ARTICLE ORDER BY Date DESC If you don't have a Date column use what ever column deno...

  • In Java, how do you outline a Polyline?

    you could try drawing the line twice. first in black with width 2 pixels and then in green with width 1 pixel.

    ...
  •  

    Categories--Copyright/IP Policy--Contact Webmaster