Thursday, February 12, 2015

Chapter 4

  • A class is the blueprint for an object, it determine what the object knows (instance variables) and what the object does (methods).
  • Instances in one class all have the same methods but the methods can 'behave' differently based on the values of the instance variables.
  • You can send things to methods.
  • You can use methods to return things.  (must declare a return type to get something back(returned))
  • Methods can return "void".
  • You can make things public or private.
  • Use brackets ([#]) to get a number of things ( a certain number of objects in an array, or the number of times the dog will bark).
  • Instance Variables have a defult value, local variables do not(method parameters act as local variables).
Variable           Default value
 

Integers                     0         
    Floating Points             0.0                      
     
    Booleans                 false                 
     
    References                null                   
     
  • Instance variables are declared inside a class but not within a method.
  • Local variables are declared inside a method.
  • Since local variables do not have a default value the must be initialized (given a value or defined) before you can run the program (but they can be placed/declared before being initialized).
  • To test if primitives are the same use == .
  • To test if objects are the same use .equals () .

Friday, January 23, 2015

Chapter 3

Variables are used to hold something; a number, a value, or a frase.
Variables are created by a type and a name.
Floats need and "f" or they will be read as a double.
Java wont let you put a large variable into a smaller one.

Names cannot start with a number.
They can start with letters or $ or a _.
Names cannot be any of Java's reserved words (below).

Friday, January 16, 2015

Java Chapter 2

I learned that Java is a pile of classes.
The object are where you do things.
Use superclasses to do less work in the subclasses.
Subclasses can override superrclasses.
Objects have instance variables and methods.
Classes are not objects, just the blueprints for them.

Monday, January 12, 2015

Java Chapter 1

         Other than the way you start coding, Java is very similar to python. You can use loops(while), boolean (True/False), statements ( like int x=3), and conditionals (if ( <, >, ==) /else).
         Boolean tests belong in parenthesis.
         Use "println" to print on a new line.
       

Monday, December 15, 2014

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? 
Strings can be printed and concatenated as a standard string.
Tuples can be appended and store different string lengths in each element.
A list of characters can only be read from.
2.  Why do computer programming languages almost always have a variety of variable types?    
Languages have different variable types because different variables' contents are incompatible by nature.
3.  Why can't everything be represented with an integer?
Technically speaking, everything COULD be represented as integers since computers store everything as 1s and 0s. But it would be difficult and inefficient.

Friday, December 5, 2014

1.3.5

Goals
    • No More then 140 Characters
    • That the following Characters were used ( ,  "  !  ?)
Code

def eligible(essay):
    a=0
    if len(essay)<=140:
        a+=1
    else:
        print ("Your essay is to long! It must be shorter than 140 characters!")
    if '?' in essay:
        a+=1
    else:
        print ("Your essay needs a question(?)!")
    if '"' in essay:
        a+=1
    else:
        print ("Your essay needs a quote("")!")
    if ', and' or ', or' or ', but' in essay:
        a+=1
    else:
        print ("Your essay needs a compound sentence(, and/, or/, but)!")
    if '!' in essay:
        a+=1
    else:
        print ("Your essay needs an exclaimation(!)!")
    if a==5:
        print ("Thank You! Your essay has been submited.")
    else:
        print ("Please fix your essay and resubmit it.")


Conclusion
1.       How many characters are in this sentence? Does it matter whether Python is storing the string as one byte per character or four bytes per character?
41 characters are in this sentence. Yes it matters, because it will take up four times more space

2.      This question asks you about something you have not learned. In fact, the question is asking about details that go beyond what you will learn in this course. However, wondering what is going on at a lower level of abstraction – and talking about it – can be a useful strategy when learning about computing.

Describe what you think occurs in memory when the following code is executed.

In []: a = 'one string'
In []: b = 'another'
In []: c = a[:3] + ' and ' + b
In []: print(c[6:10])


 a and b are saved in the code and c is defined as a[:3] + 'and' +b. When these variables are called, the code will take what is defined and use it for the variables.

Wednesday, November 5, 2014

Blown to Bits: Chapter 2 Questions

1) How many cameras per persons are there in London?

2) How do you feel about the amount of info that is stored (purchases, locations, conversations, ex. (basically any thing that has any thing to do with electronics and some other things))? Do you think this is OK?

3)Do you think there needs to be more privacy laws? Do you think that the "agreement statements" should put that "they have the right to use you information for what ever they want" at the top of the 5000 word agreements (that nobody reads) instead of buried in the middle?

4) Based on the teenagers you know, do you think more than, about, or less than 55% of teenagers use/have a social media account (Facebook, ex)?

5) Have you ever spied/stalked someone on the internet?

6) What do you think about the idea of tagging people with RFIDs?