Wednesday, February 25, 2015

Chapter 3: What I learned.......

Chapter 3: What I learned....


Within chapter 3, it detailed primitive AND reference variables and what they do and what they are defined as. The bits representing the variable is the primitive variable, but the bits representing a way to get an object on the heap is known as a reference variable. Also, if you odnt have an object assigned to the reference variable, then it is deemed null. As well as learning about these fun variable types, looking at the dog code (seen below) it taught me what arrays look like and how they should be used. Very useful indeed!


class Dog { 
 String name; 
 public static void main (String[] args) {

 // make a Dog object and access it
 Dog dog1 = new Dog();
 dog1.bark(); 
 dog1.name = “Bart”; 

 // now make a Dog array 
 Dog[] myDogs = new Dog[3]; 

 // and put some dogs in it 
 myDogs[0] = new Dog();
 myDogs[1] = new Dog(); 
 myDogs[2] = dog1; 

 // now access the Dogs using the array references 
 myDogs[0].name = “Fred”; 
 myDogs[1].name = “Marge”; 

 // Hmmmm... what is myDogs[2] name? 
System.out.print(“last dog’s name is “);
 System.out.println(myDogs[2].name); 

 // now loop through the array and tell all dogs to bark 
 int x = 0; 
 while(x < myDogs.length) { 
 myDogs[x].bark(); 
 x = x + 1; 
 } } public void bark() {
 System.out.println(name + “ says Ruff!”);  } 
 public void cat();
 public void chaseCat() 
 }

Friday, January 23, 2015

Chapter 2: What I learned...

Chapter 2: What I learned...

In chapter two, we went a little bit more in depth this time, and did activities with Brian and Brytton and Matt once again.  We worked really well together working on each activity and got it done rather quickly. There is not a whole lot to talk about because all it was, is what I explained. 

This little picture explains mostly what happened throughout the chapter and what youre supposed to learn from reading it. I can safely say that these were definitely acheived by reading and doing the activities.

Chapter 1- What I learned:

Chapter 1- What I learned:

I learned the basics of how Java works and how to code some basic things involving objects and variables. I did the basic activities that we needed to do, the magnets and commenting what the code was doingon the side, also the crossword,really enjoyed my time while doing it, while doing all of them honestly.
This was the commenting activity where you had to explain what was going on in the code. I of course did it myself, but here is a completed version done by someone else. Just wanted to give a visual :)
This is the crossword that I did as well. I worked with Brian and Brytton on this and we really worked well together. Matt also had a few good additions to the group, helped with a few answers. We got it done in a good amount of time, and here is an answer key that we found after completing it. 

Overall, going through it was a good experience and im glad that i got the chance to read this exquisite first chapter, can't wait until the next one :D
Activity 1.3.6

Conclusion

1. Consider a string, tuple, and list of characters.
In []: a = 'acbde'
In []: b = ('a', 'b', 'c', 'd', 'e')
In []: c = ['a', 'b', 'c', 'd', 'e']
The values of a[3], b[3], and c[3] are all the same. In what ways are a, b, and c different?
    
a is all letters,  b has parenthesis, and c has hard brackets.
2.  Why do computer programming languages almost always have a variety of variable types?    
to make it easier to differentiate in between things.

3.  Why can't everything be represented with an integer?

some things need to be more specific.