The 2008 Winter Scripting Games

Beginner Event 6: Coffee Break

Important: The deadline for this event has passed. Solutions are available in VBScript, Windows PowerShell, and Perl.

In Coffee Break, competitors will be asked to read from a text file and find unique entries within that file.

Not a native speaker of English? These event instructions are also available in the following languages: Chinese (Simplified); Chinese (Traditional); French; German; Japanese; Portuguese Brazilian; Russian; and Spanish. For more information, and to access these localized instructions, see the Scripting Games International page.

*
On This Page
About This EventAbout This Event
Event ScenarioEvent Scenario

About This Event

Division

Beginner

Deadline

Tuesday, February 26, 2008 (8:00 AM PST)

Points Awarded

10

Top of pageTop of page

Event Scenario

It’s Monday morning, at least half the people in the building had to work through the weekend, everyone’s a little tired and there’s still a ton of work to do. So the kindly group assistant has decided to go get everyone coffee. Each person can choose between a Latte, an Espresso, and a Cappuccino. The assistant wanders from one office to the next taking orders. (There are several people in each office.) He writes down the office number, then the number of Lattes, Espressos, and cappuccinos for each. His list looks like this:

Office 100
Espresso 3
Latte 1
Cappuccino 1
Office 200
Cappucino 2
Latte 2
Espresso 1
Office 300
…

And so on. As soon as he’s done, however, he realizes he has one problem: he doesn’t want to place an order for 3 espressos and 1 espresso and 2 espressos, etc. He needs to place an order for the total number of each type of drink. You’ll successfully complete this event if you read from the text file containing the order (Coffee.txt in the Scripting Games 2008 Competitor’s Pack) and correctly output a tally of the number of each type of drink the assistant needs to order, something like this:

Espresso: 15
Latte: 10
Cappuccino: 14

Make sure that you put the file Coffee.txt in the C:\Scripts folder. If you reference any path other than C:\Scripts\Coffee.txt your script will probably fail when we test it.


Top of pageTop of page