Practice Questions: Week 05


Strings and Command Line Arguments

1. Write a program that reads one command line argument as a string and converts the string to camel case; sample output:

java Week05Q1 monkeyseemonkeydo
MoNkEySeEmOnKeYdO

2. Extend your solution to Question 1 so that it works for an arbitrary number of command line arguments.

3. Write a program that reads an arbitrary number of command line arguments as integers and outputs the values as English strings. You can assume that the integers are in the range 0-9; sample output:

java Week05Q3 7 2 3 0
seven
two
three
zero

4. Write a program that uses the fixed-size code technique from the textbook to output the number of days in a given month where the month is specified on the command line; sample output:

java Week05Q4 Jan
Jan has 31 days

Compare this technique to the solution using a Map.

5. Exercise 6.21 from the textbook.

6. Exercise 6.22 from the textbook.

7. A challenging 1.5 hour labtest from last year.

8. Another 1.5 hour labtest from last year.

9. Another 1.5 hour labtest from last year.