This assignment has two written problems and a programming problem. Please type your solutions to the written problems and save them in PDF format. Don't forget to include your name. Remember that you may discuss the problems with other students but must write them up individually.
Submit your files by the beginning of your class section using the HW 1 submission page.
Clarification: In problems 2 and 7, the number is not given in decimal but in bases 5 and 16 respectively.
(15 points) Write a program name "BinaryCount" in Python or Java that counts in decimal and binary from 0 up to a given number given as a command-line argument. If no argument is given, your program should print a usage message. You may not use any built-in functions for printing in binary or converting to binary. Example (using Java):
% java BinaryCount usage: java BinaryCount <limit> % java BinaryCount 4 decimal binary 0 0 1 1 2 10 3 11 4 100 % java BinaryCount 17 decimal binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111 16 10000 17 10001
For a point of extra credit, make the output right-aligned.
Submit your source code (as a .py or .java file), as well as a text file containing sample output that demonstrates that your program works (copy and paste from the terminal window into a text editor).
(1 point) All directions have been followed (written file in PDF format including name, program has correct name, ...)
Note: If you are working on the lab machines, I suggest you create a directory 'cs202', make it unreadable to others, and create a subdirectory for each homework:
basin:~$ mkdir cs202 basin:~$ chmod go-rwx cs202 basin:~$ cd cs202 basin:~/cs202$ mkdir hw1 basin:~/cs202$ cd hw1