100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Resumen

Summary INF2011S- System Design code annotations

Puntuación
-
Vendido
-
Páginas
21
Subido en
03-11-2023
Escrito en
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.

Institución
Grado












Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Grado

Información del documento

Subido en
3 de noviembre de 2023
Archivo actualizado en
4 de noviembre de 2023
Número de páginas
21
Escrito en
2023/2024
Tipo
Resumen

Temas

Vista previa del contenido

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.

,
,
,
$4.14
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Gsnotes101 University of Cape Town
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
19
Miembro desde
4 año
Número de seguidores
8
Documentos
22
Última venta
1 mes hace

5.0

2 reseñas

5
2
4
0
3
0
2
0
1
0

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes