horseright.gif (6904 bytes) drivehead.gif (2283 bytes) cowleft.gif

Assignment Java-8 (GeekWatch)

Purpose: To learn how to use other classes and how to use a switch statement

Write a program that will show different time and date information based on what "code" you send it. The codes are:

    0 - number of milliseconds since January 1, 1970

    1 - number of seconds since January 1, 1970

    2 - number of days since January 1, 1970

    3 - current date and time

In other words, I want to type:


    GeekWatch 2

and see something like


    days since January 1, 1970:  10727

To do this, you will need to know how to:

Be sure to read up on what the Date class can do for you.

Instructor's solution:

    35 lines

After you have tied up this assignment, lasso the next one:

Classes and Objects




Page maintained by Marilyn de Queiroz