English subtitles

← 2 - Email Directory SOL

Get Embed Code
13 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. What this program here is part of is
    a program that shows an email directory
  2. for the Just Java Coffee Shop.
  3. And employees of the Just Java
    Coffee Shop all have email addresses
  4. that are their last name and then a
    period, their first name @justjava.com.
  5. Now what the program should be
    printing is the employee's name
  6. followed by their email
    address in this format.
  7. Let's see if it does that.
  8. Okay, so the first line here is making
    a variable called first name and
  9. setting it's value to Lyla.
  10. All right, good.
  11. And then the next line is has a variable
    called last name which its creating and
  12. it's setting that to Fujiwara.
  13. Okay, and now we're creating
    a variable called contactInfo, and
  14. setting it to something
    a little bit more complicated.
  15. Let me just make the variable right now.
  16. Okay, so we're setting it equal to the
    concatenation of the value in firstName
  17. plus a space,
    plus the value in lastName.
  18. So, first name is Lyla.
  19. Last name is Fujiwara.
  20. And this is going to be
    Lyla space Fujiwara.
  21. Okay, looks pretty good.
  22. Now for this next statement,
  23. I want to just say that these two
    bits are actually all one line.
  24. So we're taking contact info
    which we've already declared, and
  25. resetting its value equal to this.
  26. So let's figure out what this is.
  27. Well last name is Fujiwara,
    the value of first name is still Lyla.
  28. Okay so what this is doing is erasing
    what was in contact info before, and
  29. now setting it equal to opening bracket,
    concatenated with Fujiwara,
  30. concatenated with a period,
    concatenated with Lyla,
  31. concatenated with @justjava.com and
    then a closing bracket.
  32. So this is the current
    value of contact info.
  33. And on this next line here
    we display contact info,
  34. meaning that we're going
    to display this here, but
  35. this string right here is not
    the same as this string right here.
  36. In fact it's only part of the string,
    this part.
  37. We're missing the Lyla Fujiwara.
  38. Now, before we changed the string,
  39. it was storing Lyla Fujiwara,
    but we sort of overrode it
  40. in this line here when we said it
    equaled to a completely different value.
  41. What we really want is
    the concatenation of these two.
  42. So if you wanted to fix this program,
  43. you could add right here contactInfo+,
    and then all of this.
  44. That would have taken the current
    value of contact info, Lyla Fujiwara,
  45. and concatenated it with
    the email address in this format.
  46. One other short note,
    I am making an assumption that for
  47. our email addresses @justjava.com, it
    doesn't matter if this is a capital or
  48. lowercase F or if this is a capital or
    a lowercase L.
  49. For many email services that
    consumers use, this is true.
  50. For example, for Gmail, this is true.
  51. You can leave this as lower case or
    upper case and
  52. it will still reach the same person, but
  53. if you were worried about the difference
    here, that's definitely a good catch.
  54. As I've said and I'll say it again,
    case really does matter a lot of
  55. the time when we're talking about
    anything to do with computers.