Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Summary

Summary INF2011S- System Design code annotations

Rating
-
Sold
-
Pages
21
Uploaded on
03-11-2023
Written in
2023/2024

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.

Content preview

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.

,
,
,

Written for

Document information

Uploaded on
November 3, 2023
File latest updated on
November 4, 2023
Number of pages
21
Written in
2023/2024
Type
SUMMARY

Subjects

R67,00
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF


Document also available in package deal

Thumbnail
Package deal
INF- INFORMATION SYSTEMS CODE PACKAGE
-
2 2023
R 132,00 More info

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Gsnotes101 University of Cape Town
View profile
Follow You need to be logged in order to follow users or courses
Sold
20
Member since
4 year
Number of followers
8
Documents
22
Last sold
1 week ago

5,0

2 reviews

5
2
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions