Lab Assignment 1
CS202, Summer 2006

Please upload your source code files using CSNS. Note that file uploading will be disabled automatically after the lab ends, so please turn in your work on time.

1.(10pt) Write a program that reads an integer number consisting of only 0's and 1's, computes and outputs the binary, octal, and hexadecimal values of the number. For example, if the input number is 101, the binary, octal, and hexadecimal values are 5, 65, and 257, respectively. Use Scanner for input and System.out for output.

2.(10pt) Write a program which does the following:

HINT: the method Math.random() will return a random number between 0 and 1.