Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Need help with a code!

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need help with a code!

    public class Julpyssel{

    final int MIN = 0;

    final int MAX = 1;

    //deklarerar en int-array som kommer att innehålla antal timmar sömn per natt.
    int[] sleepPerNight = new int[30];

    int[] gamingPerWeek = new int[30];

    int[] studyPerWeek = new int[30];


    public void main(String[] args){

    Julpyssel stats = new Julpyssel();

    stats.fillArrays();

    stats.userInterface();

    double[] average = new double [30];

    System.out.println("The group sleeps on average"+ average +" hours/night.");

    int maxHours = linearSearch(gamingPerWeek, MAX);

    System.out.println("The most devoted gamer played "+maxHours+" hours/day.");

    userInterface();

    int median = stats.getMedian(gamingPerWeek);
    System.out.println("The median or gaming per week is "+median+".");

    double variance = stats.getVariance(studyPerWeek);
    System.out.println("The variance is "+variance+".");

    }

    public void userInterface(){
    Julpyssel stats = new Julpyssel();

    boolean running = true;

    while (running == true){

    double average = stats.getAverage(sleepPerNight);

    fillArrays();

    }//while

    }//userInterface

    //ska fylla arrayerna

    public static void fillArrays(){

    sleepPerNight[4] = 5;
    sleepPerNight[5] = 7;

    gamingPerWeek[10] = 1;
    gamingPerWeek[11] = 21;

    studyPerWeek[0] = 6;
    studyPerWeek[1] = 1;

    }//fillArrays

    public int linearSearch(int[] input, int minMax){

    return 0;

    }

    //Den ska returnera det värde som finns i mitten av listan.
    public static int getMedian(int[] input){

    return 0;

    } //Julpyssel

    double getVariance(int[] azad){

    return 0;

    }

    }

    --- Update ---

    I get the error, "cannot find symbol" in "double average = stats.getAverge"
    symbol: method getAverage(int[])
    location: variable stats of type Julpyssel


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Need help with a code!

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for newcomers, including a few "house rules" that will make you a more confident user of this forum.

    It's difficult to help you with an inaccurate copy of the error message. Copy and paste it or type more carefully - the whole thing.

  3. #3
    Member
    Join Date
    Oct 2013
    Location
    United Kingdom
    Posts
    62
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: Need help with a code!

    Thats obvious, you dont have a method getAverage(int[] var) in your class. Please fix it. Even after that you will be having few more compilation error. Please review and fix them and good luck.
    Thanks and regards,
    Sambit Swain

Similar Threads

  1. Replies: 3
    Last Post: April 27th, 2013, 07:19 AM
  2. Replies: 4
    Last Post: January 24th, 2013, 11:20 AM
  3. Replies: 7
    Last Post: January 24th, 2013, 10:41 AM
  4. Replies: 5
    Last Post: November 14th, 2012, 10:47 AM
  5. Replies: 3
    Last Post: September 3rd, 2012, 11:36 AM

Tags for this Thread