Urgent help needed.....any help appreciated....

q, Design and implement a java class called statistics that computes the mean, median, standard deviation. Design and implement a java application called statisticsDriver that generates a list of 50 integers (generated randomly) and prints the statistical measures which are calculated using the Statistis Class. Assume there will be no more then 50 input values. Compute all statical values as floating values.
The above was the question, and below is what i have done so far for the mean part, but it seems to have errors, any help???
p.s I am also confused what it means by driver class, and do i have to do individual classes for the different statistical measures....please helppppp !!!!!!!!!!, any help would be appreciated...thanks.
The class say Mean contains the following method:
public static double mean(double[] data)
double sum=0.0;
for (int index=0; index sum=sum+data[index];
sum=sum/data.length;
return sum;
The driver for this class:
public static void main(java.lang.String[] args) {
double[] myData={2,5,4,6,7,13};
System.out.println("The mean of myData");
System.out.println(Mena.mean(myData));

This is my method to work out the mean,median and mode of a set of numbers.
But what i need to do is find the mean, median and mode from a driver class, which generates a list of random numbers, no more then 50. I don't know where to fit this in my method...please help!!!!!!
main:
public static void main(String[] args) {
int[] mainArray = {2,3,6,6,6};
//outputArray( "Original Array: ",mainArray );
System.out.println("average is " + mean( mainArray ));
System.out.println("median is " + median( mainArray ));
System.out.println("mode is " + mode( mainArray ));
//mean
public static double mean(int[] mainArray) {
int sum = 0;
for (int i = 0; i < mainArray.length; i++) {
sum = sum + mainArray;
double average = sum / mainArray.length;
return average;
//median
public static int median(int[] mainArray) {
//double sortList = sort(mainArray);
final int EVEN_NUMBER_OF_ELEMENTS = 0;
int result = mainArray.length % 2;
int median = 0;
// Definition: Median is the Middle number in an odd number of entries array
// Median is the avg of the two number in the center of an even number array
if (result == EVEN_NUMBER_OF_ELEMENTS) {
int rightNumber = mainArray.length / 2;
int leftNumber = rightNumber - 1;
median = (mainArray[rightNumber] + mainArray[leftNumber]) / 2;
else { // Odd number of items, choose the center one
int rightNumber = mainArray.length / 2;
median = mainArray[rightNumber];
return median;
//mode
public static double mode(int[] mainArray)
int mode = 0;
int elements = 0;
int tempMode = mainArray[0];
int temp = 1;
int x;
for( x = 1; x < mainArray.length; x++)
if(mainArray[x-1] == mainArray[x])
temp++;
else
if(temp > elements)
tempMode = mainArray[x-1];
elements = temp;
temp = 1;
else
temp = 1;
if (temp> elements)
     tempMode = mainArray[x-1];
mode = tempMode;
return mode;
any help appreciated..

Similar Messages

  • I need any help i can get, im having trouble with the app find my iphone. I have lost my iphone, checked on the computer, and somehow, took it away so how do i get it back??

    Help
    I need any help i can get, im having trouble with the app find my iphone. I have lost my iphone, checked on the computer, and somehow, took it away so how do i get it back??

    If you are saying that after signing into iCloud it is telling you device is not found, it could be for any number of reasons. If the battery is dead, if the SIM has been removed, or if someone else has the phone and they have restored it, it will not be shown. Also, if you located it once and then sent a remote wipe, it disables the abililty to locate the phone with Find My iPhone.

  • Urgent advice needed please help!

    I need a new laptop asap that is the urgency part over with!
    The question is: How well would prem pro cs6 operate on a laptop system with:
    Intel i5 4200M dual core 3mb cache 2:6/3.2Ghz processor
    8gb ram
    nvidia gt740  2gb
    Keeping in mind I will mostly be just editing canon dale 1080p footage.
    Any help would be greatly appreciated.
    budget for laptop is 800 euro. So far the best all rounder for vid editing is: Toshiba s70-a-11h
    cheers

    That unfortunately is a common misconception with GPU acceleration. GPU acceleration handles certain frame features such as scaling interpolation, and some effects. It current does not handle decoding/encoding with Adobe. That is handled by the CPU. Because the Decoding has to start the process the CPU determines the overall performance/load on the GPU at any point in time. This also means that at any point in time the CPU is not necessarily handling less load. The CPU is just more focused on what it has to do such as decoding/encoding and many effects. All of this means no I dont think the 740M will change the user experience enough to stop the requirement for rending the timeline to playback. It will help but that is all. The CPU is really low for this type of compression. Pro Res or DNxHD would probably work ok on that CPU simply because the compression level is much lower and they are very efficient codecs with regards to performance. I would suggest looking at Cineform if you need to get this laptop and the realtime playback is not good enough for your workflow. Cineform allows you far better performance with more limited specs.
    BTW 8GB of ram is really low for GPU acceleration and HD. The biggest current mistake people are making is configuring systems without nearly enough ram to optimally handle the GPU acceleration. GPU acceleration requires a significant amount of ram because of how it works and transits through your system ram. Even if a system has the fastest CPU and best GPU, the performance is going to be poor if the system ram is to low. Most of the power available in that config would not even be utilized.
    Eric
    ADK

  • Urgent help needs - pls help me

    i have four group in my template.
    each group have subtotal at the end of it's group.
    after each group total, i need to display total (which is differance between current group and previous) right below of group total.
    and this difference need to show from second group.
    example -
    Group 1 Year
    A ( total amount for Group 1)
    Group 2 Year
    B ( total amount for Group 2 )
    Total differance C (which is B - A )
    Group 3 Year
    D ( total amount for Group 3 )
    Total differance E ( which is D - C)
    Group 4 Year
    F ( total amount for Group 4)
    total difference G (which is F - E)
    G G1
              G G2
    G 999.00E
    G1
    G 999.00
    <?xdoxslt:set_variable($_XDOCTX,’px’,xdoxslt:get_variable($_XDOCTX, 'y'))?><?xdoxslt:set_variable($_XDOCTX,’y’,xdoxslt:get_variable($_XDOCTX, 'x'))?><?xdoxslt:set_variable($_XDOCTX,’x’,sum ($G1[(./FISCAL_YEAR=current()/FISCAL_YEAR)]/AMOUNT))?>
    E
    <?xdoxslt:set_variable($_XDOCTX,’py’,xdoxslt:get_variable($_XDOCTX, 'y'))?>
    Val is
    Px is <?xdoxslt:get_variable($_XDOCTX, 'px')?>
    <?xdoxslt:get_variable($_XDOCTX, 'x')?>
    <?xdoxslt:get_variable($_XDOCTX, 'y')?>
    Diff is
    <?xdofx:xdoxslt:get_variable($_XDOCTX, 'y')-xdoxslt:get_variable($_XDOCTX, 'px')?>E
              E
    above code does not give me subtraction.
    in above code pls omit that --- http -- in code but mistake it display in post.
    any help is greatly appreciated.
    thanks.
    Edited by: user6767417 on Apr 3, 2009 5:02 PM

    Hi ,
    thanksfor reply me.
    your suggestion is working.
    but now it gives me differance between two column of same group.
    but i need differance between same column of differant group ?
    ant kind of helpis greatly apprecidated.
    thanks.

  • URGENT! NEED INSTALLATION HELP!

    Hi, so I decided to burn lion to a disk because I wanted to a fresh install on my iMac (Fall 2008). I followed an online tutorial by a well known tech reviewer to burn it to disk but I'm having trouble upon installation.
    After it boots to disk and and I erase the hard drive I click continue and what not but after the blue loading bar gets to 75% of the way through "Downloading additional components. Your computer will restart automatically" the time just starts to increase and it never completes "downloading"!
    The time is now at 45 mins and I have a very good wireless network, so it should be downloading fine but there seems to be no progress ):
    Thanks for any help.

    Cool.
    Yeh, the blue progress bar is just about where it normal freezes. The time is 12 minutes remaining to download but I'm worried that's when it hits 10 minutes it's gonna happen again ):
    I really need this to work because ive got assignments due within the next few days /:

  • Oracle History-Need ANY help.

    My Highschool international Business class require us to reasearch on a company, and i landed on Oracle...
    I think oracle will be good because it is informational driven and we are in an informational age, what's more, some chairman of oracle said he admires risk takers, so i liked it.
    But i did not find all the information I need in oracle's History page, so I decided to post a topic and wish someone would help.
    To topic, I would like information as follow to finish my project:
    1. The foundation or oracle, where did it started, who started it? where was its HQ? where is the HQ now?
    2. The history of Oracle international business, Which country other than U.S did oracle made an investment first? Where is its HQ? It would be wonderful if I can have a listed timeline of oracle international history.
    3. Ablility to adapt to cultural and economic situations: How does oracle vary to adapt to its international out posts where the culture and economy pattern might be different? (for exp, McDonalds serve Hot wings as a regional product in China, which is not available in US)
    4. Sucess and Failures: I know some of the sucess already after browsing oracle's history site, how it saved 1billion dollar and ects, but I need failures too, which move by oracle is unsucessful?
    5. Future prospects of oracle: What kind of product is oracle wish to provide in the future? Where shall oracle add investments? Explain.
    All help will be DEEPLY appreciated.

    To be frank, this is a technical forum not a thesis writing service. Also I'm not sure you've done even the basic research - this page on the Oracle website would answer all you questions in (1). But anyway, here are some links to help you.
    There are a number of books on Oracle and Larry Ellison. Even if you can't buy them I'm sure you can obtain them through your school's library.
    The ORAFAQ website has some useful kicking off points. Beyond that you'll want to start Googling for more info. Remember though, lots of stuff on the web is unreliable. The same is true of books, but to a lesser extent, because there tends to be more peer review and editorial fact-checking when it comes to deadtree technology.
    Cheers, APC

  • Help: Need  script help to delete hidden layers. Action errors using panel command.

    I am trying to make an action (that is using some scripts) that will delete hidden layers. When I try and action that in photoshop, the actions stops for an error if the file didn't have any hidden layers. I think I need to script it so it will delete the hidden layers, and keep going if there aen't any.
    I couldnt find anything in th ejavascript ref guide for doing this. ( I'm sure I was looking right at it, I am a noob).
    Thanks for any help you can give.

    Here is a script to will delete hidden layers but not throw an error is there are no hidden layers.
    try{
         var desc = new ActionDescriptor();
         var ref = new ActionReference();
         ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), stringIDToTypeID( "hidden" ) );
         desc.putReference( charIDToTypeID( "null" ), ref );
         executeAction( charIDToTypeID( "Dlt " ), desc, DialogModes.NO );
    }catch(e){}
    Note you could also do this with just actions steps. Have the action add a layer then hide it before the delete hidden layers menu item step. That way there would always be at least one hidden layer and no error.

  • Urgent help needed, please help me

    Hi,
    I am developing a web site using Java Servlets. The site requires to send XML as POST to an HTTPS server and get the response.
    Development environment:
    Laptop running Windows XP with jdk1.3.1, j2sdkee1.3 and Tomcat 4.1.
    Since I need to use https request from the servlet, I am using the following code;
    URL url = new URL("https://www.somesite.com");
    HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
    To use the above code I downloaded the jsse1.0.3_03 package from the sun website and added the three jar files to the appropriate location. Also edited the java.security file.
    The program compiles and when deployed to the web server, it works great.
    Now the problem;
    I need to deploy the web site in a server that is connected to the internet. This server is running Windows 2000 Server. It has the same jdk1.3.1, j2sdkee1.3 and Tomcat 4.1. Also I added the three jar files from jsse1.0.3_03. I also updated the classpath in the environment variable accordingly.
    Everything is pretty much similar to the Laptop that I use to develop the site except that the OS is Windows 2000 Server.
    But when I deployed the class files to the web server and tested the site, the servlet gave the following error:
    "unknown protocol: https"
    What could be wrong? I really need to fix this issue as soon as possible and any input from you will be highly appreciated.
    Thanks in advance,
    Rajesh

    Hi,
    I used java class as beans and added to JSP page as follows (the code is not complete, I am just giving the parts that are relevant);
    login.java: Implementation of login to access the database      
    *through JDBC. Uses MySQL.                              
    Last Modified: 03.22.03                    
    package user;
    import java.sql.*;
    import java.util.*;
    public class login
         private static Statement statement;
         private static Connection database;
         private static String jdbcDriver = "org.gjt.mm.mysql.Driver";
         private static String source = "jdbc:mysql://127.0.0.1/user";
         private static String username = "user";
         private static String password = "passwordforuser";
         Constructor for initializing the connection to the database                              
         public login()
              try
                   Class.forName(jdbcDriver);
                   database = DriverManager.getConnection(source, username, password);
                   statement = database.createStatement();
              catch (Exception e)
                   System.out.println("Error (From loginDatabase Constructor): " + e.getMessage());
         Used to check the users      
         public String checkUser(String userName, String passwd) throws Exception
              try
                   ResultSet names = statement.executeQuery("SELECT username, passwd FROM users");
                   while (names.next())
                   return "success";
                   return "wronguser";
              catch (Exception e)
                   throw e;
    <!--*********************************************************************************
    login.jsp: Server page to process the login request. Uses login.class to     
    *add / login users.                                        
    Last Modified: 03.23.03                         
    **********************************************************************************-->
    <%@ page import="user.login" %>
    <jsp:useBean id="login" scope="page" class="user.login" />
    <jsp:setProperty name="login" property="*" />
    <html>
    <head>
    <title>Login</title>
    </head>
    <body bgcolor="#3366FF" link="#000000" vlink="#000000" alink="#000000">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <% //Login the user and display the status
    String loginResult = login.checkUser(request.getParameter("username"), request.getParameter("password"));
    if (loginResult.equalsIgnoreCase("success"))
    %>
              <h1 align="center">You are successfully logged to the Server!</h1>
    <%
    %>
    </tr>
    </table>
    </body>
    </html>
    Hope that helps...
    Good luck!
    Rajesh

  • Macbook wont boot CD - need any help

    Alright so the other day my mac wouldnt boot up. And i took it to the apple store and they decided that i need a hard drive. so i went and bought one, and it wont boot the install cd that came with the laptop. I have no idea why with both hard drives all you see is a folder with a ? flashing. Wont boot or run anything. What do i do?

    Ok dale, thank you very much for that help. Now i got the cd to boot finally, but when i go to install it, the computer wont find the hard drive now to install it on there......it says select a destination, and its blank.

  • New to xMII, need any help documents/material

    Hi Experts,
    I am an ABAPer with 2 years experience, I am very new to xMII.
    Could anyone of you help me understand what is xMII? I would be happy if you could send me some basic material/documents for beginners to learn xMII.
    Thanks,
    Vishal.

    READ BEFORE YOU POST

  • Urgent help needed please help me out

    i m trying to make a jar file for my package named as mainPanel
    but when i run the gcs.jar file it gives following error " failed to load mainclass menifest attribute from e:/gcs/mainPanel/gcs.jar"
    could you please explain me the procedure through an example for making a jar file for a package containing many subfolder.

    http://catb.org/esr/faqs/smart-questions.html#urgent

  • Simple button rollover effect help needed - please help!

    Hi everyone,
    I was hoping someone could tell me how was this rollover
    effect done - can be seen on the small map on the right:
    http://www.refinery29.com/
    What I want to do is to be able to have the same effect on
    rollover and rollout just reversed (fade in - fade out).
    Please help!!
    THANKS

    quote:
    Originally posted by:
    NedWebs
    That naming at both ends is something I consider a fluke in
    Flash's design, but only because I don't know why it won't work the
    way you probably had it.
    There's probably some logical explanation, but I haven't
    found it, just the solution for when it happens
    It's such a minor little detail. I suspected it would be
    something this small, as that's usually the case, but I just
    couldn't put my finger on it. Not one of the places I researched
    made any reference to that when they said to name the instance of
    the button. How stupid.
    Anyway, thank you again. I can finally move forward. This was
    driving me mad.

  • Quciktime pro help needed please help help help help please

    We are trying to view our video rushes from a Lacie harddrive hooked up to our Mac laptop. These are supposed to be run through quicktime, which we have installed on the laptop as well as having just bought quicktime pro. However, we keep getting a message that the quicktime we are using has missing components and we need to upgrade, which we have done. But we still are only to get sound on the rushes and not the video images.
    We are desperate to see these rushes before our editor gets them and starts to edit. Which means we need to see them now. If anyone is up now and can help and call us to give us advice, we would be most grateful. We will of course call you straight back or if you prefer we can chat on MSN my user name is [email protected]

    Hi Mary,
    Following our tel. chat I asked the question and, as I suspected, it is a codec issue. In addition it is also a processor speed issue. Below is a reply from Dave Sawyer. a fellow L4, regarding this issue:
    I agree also that a single-processor G4 system almost certainly isn't going to handle uncompressed HD content. That's what the Pixlet codec is for; so film producers can view HD content on systems less than DP/Quad G5s. I think they're going to either have to work with more powerful systems (and make sure that they're running FCP5 on them) or get the cameraman to send them the content encoded in Pixlet.
    I realise that this may be too late as far as yourselves viewing these video rushes before they go to the editor but hopefully the above info will assist you in the future.
    RD

  • PLEASE HELP: Need some help with coding a next page button.

    so ok, in details, I'm trying to code a next page button and can't really figure out how and tried to look for them over the net but can't find the kind I am looking for. So ok, the kind of next page button I'm looking for is the kind where you have like << 1 2 3 4 5 ... (Next page button) >> not just a button where I need to hyperlink it to the next page url cuz I have like 35 pages to put... so I'm trying to figure it out yet no cigar so can someone please help me with this? Thanks!

    What I've seen done a lot (on forums with upwards of 1000 pages on some threads) is to add a "pagination" block of code that has:
    two or three pages before the current page
    two or three pages after the current page
    a drop down with ALL pages listed
    The "next" link or button is then just a copy  of the final link in the inline list.
    Something like this:
    <table>
    <tr>
    <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>Goto page <select name="generate_pagination" onchange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }"><option value="forum-page-26.html" selected="selected">1</option><option value="forum-page-26-45.html">2</option><option value="forum-page-26-90.html">3</option><option value="forum-page-26-135.html">4</option><option value="forum-page-26-180.html">5</option><option value="forum-page-26-225.html">6</option><option value="forum-page-26-270.html">7</option><option value="forum-page-26-315.html">8</option><option value="forum-page-26-360.html">9</option><option value="forum-page-26-405.html">10</option><option value="forum-page-26-450.html">11</option><option value="forum-page-26-495.html">12</option><option value="forum-page-26-540.html">13</option><option value="forum-page-26-585.html">14</option><option value="forum-page-26-630.html">15</option><option value="forum-page-26-675.html">16</option><option value="forum-page-26-720.html">17</option><option value="forum-page-26-765.html">18</option><option value="forum-page-26-810.html">19</option><option value="forum-page-26-855.html">20</option><option value="forum-page-26-900.html">21</option><option value="forum-page-26-945.html">22</option><option value="forum-page-26-990.html">23</option><option value="forum-page-26-1035.html">24</option><option value="forum-page-26-1080.html">25</option><option value="forum-page-26-1125.html">26</option><option value="forum-page-26-1170.html">27</option><option value="forum-page-26-1215.html">28</option><option value="forum-page-26-1260.html">29</option><option value="forum-page-26-1305.html">30</option><option value="forum-page-26-1350.html">31</option><option value="forum-page-26-1395.html">32</option><option value="forum-page-26-1440.html">33</option><option value="forum-page-26-1485.html">34</option><option value="forum-page-26-1530.html">35</option><option value="forum-page-26-1575.html">36</option><option value="forum-page-26-1620.html">37</option><option value="forum-page-26-1665.html">38</option><option value="forum-page-26-1710.html">39</option><option value="forum-page-26-1755.html">40</option><option value="forum-page-26-1800.html">41</option><option value="forum-page-26-1845.html">42</option><option value="forum-page-26-1890.html">43</option><option value="forum-page-26-1935.html">44</option><option value="forum-page-26-1980.html">45</option><option value="forum-page-26-2025.html">46</option><option value="forum-page-26-2070.html">47</option><option value="forum-page-26-2115.html">48</option><option value="forum-page-26-2160.html">49</option><option value="forum-page-26-2205.html">50</option></select>  <b>1</b>, <a href="forum-page-26-45.html">2</a>, <a href="forum-page-26-90.html">3</a> ... <a href="forum-page-26-2250.html">51</a>, <a href="forum-page-26-2295.html">52</a>, <a href="forum-page-26-2340.html">53</a>  <a href="forum-page-26-45.html">Next</a></b></span></td>
    </tr>
    </table>

  • Wireless printer sharing- Verizon only has automated help-or any help- for windows. i have a mac.

    i have a new Brother 490CW which instructs me to "push the WiFi protected set up button" on the router. the Verizon supplied router Ultraline series only has on/off power button.  Verizon's help is abysmal.  The automated response sends me back the the help for windows.  can anyone tell me how to set up this printer as wireless?
    thanks.

    Pretty good directions here : http://www.brother-usa.com/support/wireless/Step1.​aspx?ProductID=MFC-490CW
    You'll find the SSID (ESSID) + WEP key on a sticker on the Verizon-supplied router.
    Kevin
    Verizon Telecom
    Fiber Solution Center
    Notice: Content posted by Verizon employees is meant to be informational and does not supercede or change the Verizon Forums User Guidelines or Terms or Service, or your Customer Agreement Terms and Conditions or Plan.

  • BOM Explosion Levels: SAP Help needs some help (and so do I!)

    I'm using CS12 to explode a BOM. I added some fields to my layout - specifically "PPH" which the (f1) help calls "Path (Predecessor)" 
    The SAP Help has a BOM tree example but the formats are all wrong.  I can't tell which of their real/dummy materials go into which level of build...not to mention, shouldn't "Mat J" be a 3/1 - 3rd level of the BOM??
    I am creating a custom components report and trying to understand how these Path-Pred / Level values so I can correlate my BOM levels visually to the report results.

    Hi,
    Agree the help display of the BOM structure is not so user friendly.
    For level, the number increases when you move in vertical direction in the BOM across levels (T to B).
    For path, the number increases when you move in horizontal direction in the BOM at a given level (L to R).
    So now look thru' the values in CS12 & you should be able to figure it out.
    Regards,
    Vivek

Maybe you are looking for