-
Notifications
You must be signed in to change notification settings - Fork 8
Description
1. Divisor Pattern Art
Print a table of size NxN where an entry (i, j) is:
- @
@ character + 1 space characterif i divides j or j divides i - Two empty space characters, otherwise
For example:
@ @ @ @ @ @ @ @ @ @ @ @ @ @ @
2. Twenty Questions Game
Write a program which assumes a random integer X in some range, say 1 - 100,000. It prompts you to input a number and responds with the following information:
- Input number is higher than X
- Input number is lower than X
- Input number is equal to X, in which case you win the game
Your program gives 20 chances to guess the number and you lose if you fail to guess.
You can use Java's Math.random() to generate a random number. Note that it returns a double, but we want an int
3. Fibonacci
The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ...
Write a program which accepts as input an integer N and returns the N-th Fibonacci number. To test whether your program returned the correct number, go to Wolfram Alpha, and enter fibonacci(N) where N is your input integer
4. A Pretty Title
Write a program that calls a method printTitle that prints a phrase as a title by,
- converting it to title capitalization
- underlining each word, i.e. underlying all characters except spaces
For example,
printTitle("a tale of two cities", '*')
produces
A Tale of Two Cities
* **** ** *** ******
5. Who is more verbose : Dickens or Melville?
Fork the repo VerbosityCalculator and follow the instructions in the repo
6. Weekly requirements
- WRITE a Medium post about something technical or non technical you learned this week
- TWEET at least once!
- READ Weekly Think Piece: How I, a designer learned to code and released an app in 4 months
7. Submission
Post a link to your homework GitHub repositories + link to your Medium post as comment to this issue by Friday 3/20 8pm.
Submission format: : Same as last week
Bonus Challenges! (optional)
Exercise: [optional] Write a method that counts the number of words in a string. For example,
coundWords("Eighty percent of success is showing up.")
returns 7.
Exercise: [optional] Write a method that computes the average word length. To compute the average, count the total number of letters in words (not including spaces) as well as the total number of words, and divide them. Make sure the result is a double, not an int. For example,
averageWordLength("Eighty percent of success is showing up.")
returns about 4.714.
Execise: [optional] Write a method that replaces all occurrences of "man" with "wo/man", "men" with "wo/men", "he" with "s/he", "his", with "his/her", and "him" with "him/her". Feel free to substitute your own preferred gender-neutral nouns and pronouns.
Exercise: [optional] Write a method that reverses a string by order of words (rather than characters). Treat punctuation as part of a word.
For example,
reverseWords("You miss 100% of the shots you don’t take.")
returns
"take. don't you shots the of 100% miss You"
For extra credit, try to preserve sentences by leaving punctuation at the end and fixing capitalization, so that the result is instead,
"Take don't you shots the of 100% miss you."