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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:11:18+00:00 2026-06-09T16:11:18+00:00

I’m a self-taught beginning programmer. I’ve designed a horse racing program that reads in

  • 0

I’m a self-taught beginning programmer. I’ve designed a horse racing program that reads in a file that has information on each horse in each race, including information on the horse’s previous 10 races. Then outputs the information into a readable format, kind of like a horse racing form or program.

For example, on Saturday August 10th at Churchill Downs there are 9 races and 8 horses in each race. So, the csv file for that day would contain 72 horses. Each of those horses would also have statistics on their last 10 races.

What I have currently done is read in the csv file to a List. Then I transfer the information contained in the List to a List of Horse objects, which basically stores all the information for each horse.

I feel that the only benefit I’m getting from using a class to store all the information is that it’s easier to manipulate that data as I don’t have to remember indices.

I’m wondering if there’s a better way to design this program? Any insight?

  • 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-09T16:11:19+00:00Added an answer on June 9, 2026 at 4:11 pm

    If you think about what’s really going on here, you have horses, races, and a particular horse’s performance in a particular race.

    So, if you allow your class design to follow this, you might have something like this:

    public class Horse
    {
        public string Name { get; set; }
        public Gender Gender { get; set; }
        public Breed Breed { get; set; }
        public DateTime WhenBorn { get; set; }
        // etc...
    
        public TimeSpan GetAge()
        {
            return DateTime.Now - WhenBorn;
        }
    }
    
    public class Race
    {
        public string Venue { get; set; }
        public DateTime WhenStarted { get; set; }
        public DateTime WhenFinished { get; set; }
        // etc...
    }
    
    public class HorseRace
    {
        public Race Race { get; set; }
        public Horse Horse { get; set; }
        public int? PlaceFinished { get; set; } // null if did not finish
        public string JockeyName { get; set; }
        public double HorseWeighIn { get; set; } // weight of horse at time of race
        public double JockeyWeighIn { get; set; } // weight of jockey at time of race
        // etc...
    }
    
    public enum Gender
    {
        Colt,
        Filly
    }
    
    public enum Breed
    {
        // fill in breeds here
    }
    

    Once you have a class design you like, you can start thinking about how to store your data to make it easiest to get it into your classes. Instead of one giant csv file with a lot of repeated data, you could have a separate file for each class, so Horses.csv, Races.csv, HorseRaces.csv. Eventually, you may want to upgrade from CSV to a small file-based database.

    Ultimately, you’d like to have three lists: Horses, Races, and HorseRaces. To display these lists, you could loop through your HorseRaces, and easily grab all the data you need simply by using the properties of HorseRace and, subsequently, properties of Race and Horse. For example, horseRace.Horse.Name.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
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 string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.