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 6996331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:08:33+00:00 2026-05-27T20:08:33+00:00

I’m used to python and django but I’ve recently started learning java. Since I

  • 0

I’m used to python and django but I’ve recently started learning java. Since I don’t have much time because of work I missed a lot of classes and I’m a bit confused now that I have to do a work.

EDIT
The program is suppose to attribute points according to the time each athlete made in bike and race. I have 4 extra tables for male and female with points and times.
I have to compare then and find the corresponding points for each time (linear interpolation).

So this was my idea to read the file, and use an arrayList

One of the things I’m having difficulties is creating a two dimensional array.
I have a file similar to this one:

12    M    23:56    62:50
36    F    59:30    20:60

Where the first number is an athlete, the second the gender and next time of different races (which needs to be converted into seconds).

Since I can’t make an array mixed (int and char), I have to convert the gender to 0 and 1.

so where is what I’ve done so far:

    public static void main(String[] args) throws FileNotFoundException {
        Scanner fileTime = new Scanner (new FileReader ("time.txt"));
        while (fileTime.hasNext()) {
            String value = fileTime.next();
            // Modify gender by o and 1, this way I'm able to convert string into integer
            if (value.equals("F"))
                value = "0";
            else if (value.equals("M"))
                value = "1";
            // Verify which values has :
            int index = valor.indexOf(":");
            if (index != -1) {
                String [] temp = value.split(":");
                for (int i=0; i<temp.length; i++) {
                    // convert string to int
                    int num = Integer.parseInt(temp[i]);
                    // I wanted to multiply the first number by 60 to convert into seconds and add the second number to the first
                   num * 60; // but this way I multiplying everything
            }
        }
        }   

I’m aware that there’s probably easier ways to do this but honestly I’m a bit confused, any lights are welcome.

  • 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-05-27T20:08:34+00:00Added an answer on May 27, 2026 at 8:08 pm

    Just because an array works well to store the data in one language does not mean it is the best way to store the data in another language.

    Instead of trying to make a two dimensional array, you can make a single array (or collection) of a custom class.

    public class Athlete {
      private int _id;
      private boolean _isMale;
      private int[] _times;
      //...
    }
    

    How you intend to use the data may change the way you structure the class. But this is a simple direct representation of the data line you described.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I have thousands of HTML files to process using Groovy/Java and I need to
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I used javascript for loading a picture on my website depending on which small
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.