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 mechanism of the integer types, rewrite the BliposClock class to use the modulus operator to accomplish exactly the same tasks.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net