Programming Exercises


Change the program BliposClock.cs in Listing 6.8 to exhibit the functionality presented in the next four points:


Enable the clock to be adjusted by plus/minus 100 seconds by giving the commands H and M.


A year on Blipos has 256 days. The first day of the year has number 0. The civilization is very old on Blipos; their current year is 4,294,967,296. Allow the Blipos clock to show the date on Blipos as ddd/y,yyy,yyy,yyy. Which types would you choose for ddd and yyyyyyyyyy?


Allow the user to set and adjust the day and year of the Blipos clock so that it becomes possible to move forward and backward in time by one day and one year.


The emperor's birthday is celebrated on the 100th day of each year. Enable the Blipos clock to write "Happy birthday emperor!" onscreen whenever the date is shown to be the 100th day of the year.


Write a program containing a method called AverageAge that calculates the average of three ages provided to it as arguments. Enable the user to enter three ages (as whole numbers) and use AverageAge to calculate the average age and print the result with a precision of three decimals. Which return type would you use for AverageAge? How can you format the output?


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

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: