SJSU/Udacity CS046

Lesson 4 - Fundamental Data Types

  1. Introduction
  2. Introducing Ingrid
  3. Working with Numbers
  4. Quiz: Overflow
  5. Quiz: Precision
  6. Doubles Are Fuzzy
  7. Quiz: Number Types
  8. Quiz: Arithmetic Operations
  9. Quiz: Integer Arithmetic
  10. Quiz: Arithmetic Operations 2
  11. Ingrid Talks About Order of Operations
  12. Quiz: Color Reduction
  13. Quiz: Color Reduction 2
  14. Quiz: Day of the Week
  15. Quiz: Checkerboard
  16. Quiz: Casts
  17. How to Cast
  18. Quiz: Casts 2
  19. Ingrid Talks about Learning Casting
  20. Quiz: Grayscale
  21. Quiz: Math Functions
  22. Quiz: Sunset Effect
  23. Quiz: Magic Number
  24. Reading Input
  25. Quiz: Your Own Sunset Effect
  26. Formatted Output
  27. Quiz: Practice Formatted Output
  28. Quiz: Formatted Output Practice Part 2
  29. First Do It by Hand
  30. First Do It by Hand Part 2
  31. Quiz: Your Turn to Do It by Hand
  32. Quiz: Strings
  33. Working with Text
  34. Quiz: Working with the Book Text
  35. Quiz: Mad Hatter
  36. Quiz: Get the First Sentence
  37. Quiz: Get the Second Sentence
  38. Quiz: Occurrence of Alice
  39. Quiz: Occurrence of Any Word
  40. Quiz: Putting It All Together
  41. Quiz: Polish Our Code
  42. Calculating Circular Fields
  43. Formula for Calculating Circular Fields
  44. Quiz: How Many Rows of Fields
  45. Quiz: How Many Columns Can We Fit?
  46. Quiz: Number of Odd vs. Even Rows
  47. Quiz: How Many Fields Can We Fit?
  48. Quiz: Let's Program It Up
  49. How Programming Impacted Ingrid's Life
  50. Advice from Ingrid

Quiz: Polish Our Code

Which methods should we remove or generalize, and which should we keep?

  1. Remove or generalize|Keep public int occurrencesOf(String word)
  2. Remove or generalize|Keep public int occurrencesOfAlice()
    You don't want a method to search for a specific word when you can have one that searches for any word.
  3. Remove or generalize|Keep public int getFirstSentence()
  4. Remove or generalize|Keep public int getSecondSentence()
    It would make sense to generalize to a method that gets the nth sentence for an arbitrary n. But that's not what Sara is planning to do, because we haven't yet learned how to do it. Don't worry if you said “Remove or generalize” here.
  5. Remove or generalize|Keep public int getNumCharacters()
  6. Remove or generalize|Keep public int firstOccurrenceOfMadHatter()
    It would be better to have a method that finds the first occurrence of any word.
  7. Remove or generalize|Keep public void readBook(String fileName)

Problem on this page?

Your name:

Your email address:

Problem description:

To protect against spam robots, please answer this simple math problem:
× =