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 ...

Get C# Primer Plus 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.