Tuesday, January 13, 2015

Head First into Java: Chapter 1

In Beer Song Activity, we had to code "99 bottles of beer" song using if/else statement, variables and while loops. However when completing this task a problem presented itself; when there was one bottle left it would say "1 bottles of beer on the wall" and this is not proper grammar. Therefore, I created an if/else statement that tells the program if there is one bottle left then switch "bottles" to "bottle".


In this chapter I've learned many thing such as
  • Variables are declared with a name and a type 
  • white blank spaces don't matter
  • Classes and method are defined within curly braces
  • Functions such as String and System.out.print have to be captitalized
  • ln after System.out.print makes the result in a diffrent sentence 
In the phrase o matic activity uses list to create phrases. Instead I created a phrase that chooses what color shirt to where randomly. This activity has taught me to use the Math.random  function with the int function to make the value and interger.

No comments:

Post a Comment