O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming Exercises

Change the DayCounter.cs source program in Listing 7.2 to exhibit the following functionality:

1:Apart from reporting every Sunday, it should also report every Saturday. Hint: At the moment, the program is detecting every 7, 14, 21, 28, and so on. Which numbers does it need to detect to find all the Saturdays? Those would be 6, 13, 20, 27, and so on. How do they relate to the Sunday numbers? How can this be implemented?
2:Let's say that every year in the simulation has 365 days. Change the program to let it report the running time in days, weeks, and years, instead of just the days and weeks reported currently.
3:Recall the Blipos Clock case study in Chapter 6, “Types Part I: The Simple Types.” Instead of relying on the overflow/underflow ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required