100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Summary INF2011S- System Design code annotations R67,00   Add to cart

Summary

Summary INF2011S- System Design code annotations

 20 views  0 purchase

Comprehensive examples of all types of code questions they could as and how to do/ understand all lines of code for the entire course. Workshops & lecture examples with annotations.

Last document update: 1 year ago

Preview 5 out of 21  pages

  • November 3, 2023
  • November 4, 2023
  • 21
  • 2023/2024
  • Summary
avatar-seller
Gsnotes101
INF1003F – Workshop 9




The Durban July is an annual horse meet that has been presented every year since 1897
where horses compete in a series of races. Write a C# program to handle registrations for
the race. The program must meet the following specifications:

Question 1 – Classes [40]

Create a class, Horse, to save the following information for each horse in the race:
o Name – String value representing the horse name;
o Age - Age in years (integer);
o Height - The height of the horse in hands (integer); and
o Times – An array that stores the times that the horse achieved in the last
three races in seconds (double).

The class should have the following methods:

o Horse(): Default and parameterized constructors
o double AverageTime(): A method that returns the average time of the last
three races.
o string HorseDetails(): A method that returns a string representation of the
horse in the following format:

“Name: <name>\tAge: <Age>\tHeight: <height>\t Average run: <AverageTime()>”


Create a class, July, that contains the information for all the horses in the meet:
o List<Horse> horses: A list of Horse objects for all the horses that are
participating

The class should have the following methods:
o public July: Default constructor
o public void AddHorse(Horse): A method that adds the Horse argument to
the List of horses.
o public void DisplayRoster(TextBox): A method that displays the roster for
the upcoming final race on the TextBox argument by calling the
HorseDetails() method for each horse.
o public Horse Favourite(): The horse with the best average time for the
previous races is named the favourite. Identify the favourite from the list of
horses and return it to the calling statement. Assume that each horse's time
will be unique.

, INF1003F – Workshop 9


Question 2 – Main program [10]

The main program must have the following functionality:

o Create a user interface as in the example below. The output area is a multi-
line TextBox.
o When the form loads, create a class-level (global) object of the July class.
o When the “Add” button is clicked, use the July object methods and the input
fields on the form to add a new horse to the meet roster. Display the roster
with the method in the next section.
o Write a method Display() and use the relevant methods of the July and
Horse classes to show the roster for the next race. See the figure below for
example output.
o When the “Predict next winner” button is clicked, display the favourite horse
in a MessageBox by using the appropriate methods of the July and Horse
classes.

,
,
,

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Gsnotes101. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R67,00. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

79223 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R67,00
  • (0)
  Buy now