Friday, January 9, 2015

Headfirst Java, Chapter 1

Chaper 1 of this book was interesting, and its much better than the boring textbooks like in history or math. However, it was only chapter 1, and since I already have a small background in java, I did not really learn too much from this. I did get better at what I already know, however. I was able to troubleshoot the 99 bottles of beer program and successfully make it run. My corrected code is shown below.
99 Bottles of Beer Program.

The error was one line was saying "1 bottles of beer on the wall" and that improper grammar. I simply added an else if statement so that if there was 1 bottle left, it would print "bottle" instead of "bottles". Also, this chapter served as a refresher for me since it has been a year or two since i have done any coding in java, and since then I have learned python. Python syntax is like java in many ways but is less complex. I have found myself almost writing python syntax when writing the code above. I have high hopes for this book, not only as a refresher for what I already know, but also later, to teach me more of the language. 

Wednesday, December 17, 2014

1.3.8

1.3.8 While Loops
Number Guesser

Conclusion:

1. If you change between 1 and 20 from the previous program to between 1 and 6000, how many guesses will you need to guarantee that you have the right answer? Explain.

6000 because there are 6000 numbers one can guess so someone could guess every number except the right one, then the last guess would be the right one, which would add up to 6000 guesses.

2. Describe the difference between a while loop and a for loop.

A for loop repeats a block of code for every time an event occurs. A while loop repeats a block of code so long as a condition remains true.

Sunday, December 14, 2014

1.3.7

1.3.7 For Loops

Mastermind


Lottery Ticket



Questions:
1. Sometimes code using an iterative loop can be written without a loop, simply repeating the iterated code over and over as separate lines in the program. Explain the disadvantages of developing a program this way.


If a program is developed this way, it will take up much more space, be more time consuming, and take longer to run than if the code were just created with a loop.

2. Name a large collection across which you might iterate.

A collection of music, perhaps to make sure two directories have the same exact songs and to fill the ones that are missing from each other. my collection has about 900 songs, and the are people with much bigger ones out there.



3.What is the relationship between iteration and the analysis of a large set of data?
One can generate a program to iterate a block of code that preforms an action on each datum in the set. For example, a program could examine a set of numbers and for each number that is over 10, increase a variable by 1.

Monday, December 8, 2014

1.3.6 Tuples and Lists

1.3.6 Tuples and Lists




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 a string, b is a tuple, and c is a list.

2. Why do computer programming languages almost always have a variety of variable types?
Not everything can be answered with one variable type. For example, some situations require a true

or false statement whereas others require a number. These varibales would have to be two different types.

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

Not all situations require an integer. Some require a true or false. Others require a float in that the decimal places need to be accounted for.

Thursday, December 4, 2014

Tweet
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. Yes becuase unicode uses four bytes per character, and ASCII uses one byte per character. unicode offers a wider range of characters.

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 is stored, and b is stored. c is stored as 'one' from a, a new part; ' and ' and b. then the print command calls c, but only characters 6 through 10; "d an"

Wednesday, November 19, 2014

Blown To Bits
Chapter 2:

1. Define an RFID and explain its function.



2. Illustrate (with words) how a government could abuse RFIDs, and explain why it would be so easy.



3. A document printed from a laser printer can be traced back to that printer and thus to the person who printed it. Describe how this can occur and elaborate on your opinion of whether this is a good or bad thing.



4. Some parking garages take photos of the licence plate of a car when entering. Create a situation that is completely legal where this might be a bad thing.



5. Determine how information, such as time stamps, from having an E_ZPass could be a hinderance, if you are not doing anything wrong.

Tuesday, November 4, 2014

Text bombing Application

Description:
This app allows you to send up to 500 text messages at once to one person. This is known by many people as "Text Bombing" and is annoys a lot of people. However, it is very fun to do to people. You pick a person from your contacts using the "Phone Number" button. Then you type whatever you want to say in the text box. next you adjust the slider for how many texts you want to send. The number next to the slider is how many texts that will be sent. When you are ready, click the "Send" button and wait for your friend to be irritated with hundreds of texts.

https://drive.google.com/file/d/0B73rAyJ5mEH5Um82ekJxU2hETDA/view?usp=sharing

Conclusion Questions:

  1. We brainstormed for ideas, chose one and determined how we would accomplish it. Then using a feedback loop we went into development and completed the goal we set out to accomplish. overall it was a very simple creative process. It was rather useful. I believe it was not very restricting which was a good thing. this is because you can go back and redo steps if necessary. 
  2. Our team worked very well together because we know each other and are friends. We enjoy each others company which makes working together a lot easier. Very little disagreements arose but the ones that did we resolved logically.
  3. Our App was trying to solve the problem of boredom and give a way to send mass amounts of texts to one person when you have a smart phone. smart phones cannot do this very efficiently but this app does it for you.
  4. The hardest challenges to overcome were getting the app to send a text message and figuring out why a "run-time error" kept popping up. We solved it by making a side app just to send one text and figuring out why texts were not being sent. We accomplished this by changing the message being set when the message box lost focus, to the message being set when the "Send" button was pressed. Once we accomplished this the "run-time error" went away as well. so we took out two birds with one stone here.

     5. Given more time, we could add a sound file that plays in the background. We could also add a phone number box that allows you to type phone numbers manually. Lastly we could add the ability to send many text to multiple people through phone numbers and emails.