Part I. C# Lab: A Day at the Races

Name:

_______________

Date:

_______________

This lab gives you a spec that describes a program for you to build, using the knowledge you’ve gained over the last few chapters.

This project is bigger than the ones you’ve seen so far. So read the whole thing before you get started, and give yourself a little time. And don’t worry if you get stuck—there’s nothing new in here, so you can move on in the book and come back to the lab later.

We’ve filled in a few design details for you, and we’ve made sure you’ve got all the pieces you need...and nothing else.

It’s up to you to finish the job. You can download an executable for this lab from the website...but we won’t give you the code for the answer.

The spec: build a racetrack simulator

Joe, Bob, and Al love going to the track, but they’re tired of losing all their money. They need you to build a simulator for them so they can figure out winners before they lay their money down. And, if you do a good job, they’ll cut you in on their profits.

Here’s what you’re going to build for them....

The Guys

Joe, Bob, and Al want to bet on a dog race. Joe starts with 50 bucks, Bob starts with 75 bucks, and Al starts with 45 bucks. Before each race, they’ll each decide if they want to bet, and how much they want to put down. The guys can change their bets right up to the start of the race...but once the race starts, all bets are final.

The Betting Parlor

The betting parlor keeps track of how much cash each guy has, and what bet ...

Get Head First C#, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.