Skip to content

D4rkJvck/The_Book

Repository files navigation

The-Book

Practice

Chapter 3

  • temperatures: Convert temperatures between Fahrenheit and Celsius.

  • fibonacci: Generate the nth Fibonacci number.

  • lyrics: Print the lyrics to the Christmas carol “The Twelve Days of Christmas,” taking advantage of the repetition in the song.

Chapter 8

  • statistics: Given a list of integers, use a vector and return the median (when sorted, the value in the middle position) and mode (the value that occurs most often; a hash map will be helpful here) of the list.

  • pig_latin: Convert strings to pig latin. The first consonant of each word is moved to the end of the word and “ay” is added, so “first” becomes “irst-fay.” Words that start with a vowel have “hay” added to the end instead (“apple” becomes “apple-hay”). Keep in mind the details about UTF-8 encoding!

  • company: Using a hash map and vectors, create a text interface to allow a user to add employee names to a department in a company. For example, “Add Sally to Engineering” or “Add Amir to Sales.” Then let the user retrieve a list of all people in a department or all people in the company by department, sorted alphabetically.

Chapter 17

  • blog
    • Add a reject method that changes the post’s state from PendingReview back to Draft.
    • Require two calls to approve before the state can be changed to Published.
    • Allow users to add text content only when a post is in the Draft state. Hint: have the state object responsible for what might change about the content but not responsible for modifying the Post.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published