Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9156329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:45:03+00:00 2026-06-17T12:45:03+00:00

I am building a program that simulates a dive competition. I have a class

  • 0

I am building a program that simulates a dive competition. I have a class Athlete that essentially is trying to access an array element in another class. Would anyone know how I can access the data?

Here is the Athlete class:

public class Athlete {

    public static String[] name = { "Art Class", "Dan Druff", "Jen Tull" };
    public static String[] country = { "Canada", "Germany", "USA" };
    Performance[] performance = new Performance[2];

    public Athlete(String[] name, String[] country) {
        this.name = name;
        this.country = country;
        // this.event = event;
    }

    public void perform() {
        Dive mydive = new Dive(Dive.diveName, Dive.difficulty);
        Performance event = new Performance(event.dive, Performance.judgeScores);
        performance[0] = event(event.dive.diveNames[0], event.judgeScores); // here
        performance[1] = event; // Here
        performance[2] = event; // Here
    }

    public void printResults() {
    }
}

Where indicated with “//Here” I am trying to access the data from the classes that are shown below, and I’m wondering how can I do that?

Performance:

public class Performance {

    Dive dive = new Dive(Dive.diveName, Dive.difficulty);
    public static float[] judgeScores = new float[7];

    public Performance(Dive dive, float[] judgeScores) {
        this.dive = dive;
        // this.dive=difficulty;
        this.judgeScores = judgeScores;
        // this.judgeScores = judgeScores;
    }
}

Dive:

import java.util.Random;

public class Dive {
    public static String diveName;
    public static int difficulty;

    public static final String[] diveNames = { "reverse pike", "forward pike",
            "reverse armstand with double somersault", "reverse triple twist",
            "double forward with triple somersault", "cannon ball" };
    public static final int[] diveDifficulties = { 3, 2, 2, 4, 4, 1 };

    public static Dive chosenRandomly() {
        Random rand = new Random();
        int num = rand.nextInt(6) + 1;
        String diveName = diveNames[num];
        int difficulty = diveDifficulties[num];

        Dive dive = new Dive(diveName, difficulty);
        return dive;
    }

    public Dive(String diveName, int difficulty) {
        this.diveName = diveName;
        this.difficulty = difficulty;
    }
}

Are my constructors all wrong?

PS: This is homework so some people might not find my method to be the appropriate way to tackle the problem, but please keep in mind that I’m following the instructions.

Thanks in advance for any input!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:45:04+00:00Added an answer on June 17, 2026 at 12:45 pm

    Assume that you are working in a directory called Javadir, and that you create four files, whose contents are shown below.

    file 1

    package ListPkg;
    public class List { ... }
    class ListNode {...}
    

    file 2

    package ListPkg;
    public class NoNextItemException { ... }
    

    file 3

    public class Test { ... }
    class Utils { ... }
    

    file 4

    class Test2 { ... }
    

    Here are the directories and file names you must use:

    File 1 must be in a subdirectory named ListPkg, in a file named List.java.

    File 2 must also be in the ListPkg subdirectory, in a file named NoNextItemException.java.

    File 3 must be in a file named Test.java (in the Javadir directory).

    File 4 can be in any .java file (in the Javadir directory).

    For more guidelines, go through this notes on java packages

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a application that sends a test message to another email, the program
I'm building a program that takes two files and after some processing, I have
I am building a program for class that is supposed to function as a
I have a program that I am trying to write that one row of
I'm currently building a program that primarily uses ABSDatabase, however I am trying to
I'm building a program in Java that simulates a network of moving nodes. When
I am building a program that will update an early voted column in my
I am building a program that takes an input file in this format: title
I am building a C# program that unzips a file, and work on this
I'm building a site in django that interfaces with a large program written in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.