Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | Visual C# (55 exercises) |
Topic ==> | Interfaces (2 exercises) |
Level ==> | Average difficulty |
Subject ==> | C# training |
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.
Create a new project called Advanced_CSharp_exercises. Add the files in the folder above into this project.
To do this, right-click on the project and choose Add --> Existing Item... Be careful to add all of the files, not just the ones of certain type.
Set the frmMeetings form to be the default one for the project, then run the project - you should now see that it gives you a very short list of invitations to send:
Each invitation has a description, an addresse and the text.
To start, have a quick look at the Venue, Customer, Tryst and RoomHire classes.
If you look at the code behind the form, you'll see that it also creates 3 venues, 3 customers, 2 trysts (dates between customers) and 2 room hires:
// create some venues
Venue RedLion = new Venue("Red Lion, High Street");
Venue CostaCoffee = new Venue("Costa Coffee, Market Street");
Venue CatholicChurch = new Venue(
"Church of Immaculate Conception, Church Road");
// create some people
Customer c1 = new Customer("Rita", "Brown");
Customer c2 = new Customer("Sue", "Jones");
Customer c3 = new Customer("Bob", "Smith");
// arrange some trysts between customers (Bob
// pessimistically meets 2 ladies)
Tryst t1 = new Tryst(c1, c3, RedLion,
new System.DateTime(2013, 11, 25, 11, 30, 0));
Tryst t2 = new Tryst(c2, c3, CostaCoffee,
new System.DateTime(2013, 11, 25, 12, 0, 0));
// now add separate room hires for speed
// dating (2 running simultaneously,
// although the Catholic Church one doesn't last as long)
DateTime whenStart = new System.DateTime(2013, 11, 22, 10, 0, 0);
RoomHire rh1 = new RoomHire(CostaCoffee,
whenStart, whenStart.AddHours(2));
RoomHire rh2 = new RoomHire(CatholicChurch,
whenStart, whenStart.AddHours(1));
Some code has been commented out:
// now create some happenings!
// List happenings = new List{I_Happening>();
// happenings.Add(t1);
// happenings.Add(t2);
// happenings.Add(rh1);
// happenings.Add(rh2);
Your task is to add an interface called I_Happening which includes the following member:
// a happening must support a list of invitations
List Requests { get; }
You'll need to amend the Tryst and RoomHire classes to implement this interface, and get them to support the required property.
Uncomment the code which is commented out. Add code to add one row to the data table for each request for each happening!
Run your program - you should get something like this:
Notice how each tryst has added two invitations: one for each person.
Close down any open files!
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.