Visual C# | Creating classes exercise | Create a class to hold a football result

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the course listed below!

Software ==> Visual C#  (79 exercises)
Version ==> Any version of C#
Topic ==> Creating classes  (4 exercises)
Level ==> Relatively easy
Course ==> Intermediate C#
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

If you haven't already got one, create a Windows Forms project (using Visual C#, obviously) called wiseowl.  Right-click on your project in Solution Explorer to add an existing item, and choose the file frmScore.cs in the above folder.

Make this the default form in Program.cs.  When you run your application, you should be able to enter a result:

Football result

When you click on the OK button, you should see the summary shown on the next page.

When you click on the OK button, you should see a message like this:

Number of points

In the premier league you get 3 points for a win, 1 for a draw and nothing if you lose.

 

What's that?  Preston aren't in the premier league?  Not yet, they're not ...

See the next page for notes on how to proceed.

The good news is that all the code to do this is already written - all that you need to do is to uncomment it:

Commented code

The code that you need to comment back in.

The bad news is that this refers to a class called FootieResult which doesn't exist ... yet!

Write the class, uncomment the code and then test your system works! 

This page has 0 threads Add post