Friday, January 30, 2015

Java project

This code picks a random number between 1 and 100, and sets it to numberToGuess. It also assigns three other variables, win, guess and numberOfTries. Every time a guess is made, that integer is set to the guess value, which is then checked if it is equal to the numberToGuess. If it is not the numberToGuess, then win remains false and two new methods are run. The first method checks if the guess is greater than the numberToGuess. If true, then it will tell you that your guess is too high. Else, if the guess is less than the numberToGuess, it will tell you that your guess is too low. Every time a guess is made, one is added to the numberOfTries. When the guess is equal to the randomly assigned numberToGuess, the boolean value win is set to true and the build ends after telling you the numberToGuess and the numberOfTries.



Wednesday, January 28, 2015

Chapter 3 Headfirst into Java


In chapter 3 you learn about variables and how you can declare them, assign them values, and use them. You have to be careful declaring a variable, you need to be aware of the types of variables. There are primitive variables and object reference variables. Values can be assigned to variables in similar ways to python: you can give a variable a numeric value by using an equals sign, equate it to another variable, and create an expression with other variables and numeric values. Remember: objects are not variables.

Dog Code:
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";

        //Hmmm... what is myDog[2] name?
        System.out.print("last dog's name is ");
        System.out.println("myDogs[2].name);

        //new 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();

Tuesday, January 27, 2015

Chapter 2 Headfirst into Java

In Chapter 2 you about how object oriented programming is considered better than procedural programming by the majority. A major benefit of object oriented programming over procedural is that you can change the code easily without unknowingly alter the code while changing one part. Object oriented programming has an object contain a method. Any code pertaining to that object can be run if the class is called for; in procedural, the code is in a linear pattern and usually has a significant amount of lines . Object oriented programming also allows you to assign similar objects to a class to simplify your code.Object oriented coding gives you the option to assign similar objects to classes to compact and simplify your code.

Chapter 1 Headfirst into Java

The 'Beer Song Activity' had us code the "99 bottles of beer" song using if-else-statements, while loops, and variables. As expected we ran into a problem; when there was one bottle left it would say "1 bottles of beer on the wall" as opposed to "1 bottle of beer on the wall". To fix this I changed the coding so that if the number of bottles is 1 change "bottles" to "bottle".


I learned that Classes and methods are defined within curled braces.
I learned that Variables have a type and name.
I learned that System.out.print and variables require capitalization.
I learned that blank spaces do not matter.
I learned that In after System.out.print results in a different sentence

Wednesday, December 10, 2014

Conclusion


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?
They are different because one of them was taken out of a complete string, one was taken from a list, and one was taken from a set of strings.
List: Elements of list can be changed
Tuple: Elements of tuple cannot be changed
String: Is a whole


2.      Why do computer programming languages almost always have a variety of variable types? Why can't everything be represented with an integer?
There are a variety of types so that if you need to put different values together you can make it easier. Everything can not be an integer because some things can not be represented by a number

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 are in the sentence. It should not matter as long as it is consistently stored.



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])

It sets 2 variables and the 3rd line takes certain characters out of the strings and sets it to 'C', which equals ona and another. It then says to print the 6th through the 10th character making it print: 'd an'. 

Thursday, November 6, 2014

MIT app


The Notepad Xtreme

The Multi-App Extraordinaire:
This Multi-App includes the Notepad, Checklist, Conversion, and Wooer applets all in one place. The Notepad app stores text, the Checklist app is a Checklist, The Conversion app converts one unit to another (liters to gallons), and the wooer app generates a pick-up lines.

Reflection Questions:

1.  Reflect on the creative process you used. What was useful? Discuss your reflection with your partner and then write a reflection individually.We had a lot of ideas we wanted to use so we decided on making as many as we could in one app and we all had ideas for each of the features.

2.      Reflect on the team dynamic. What helped the team work well together? Discuss your reflection with your partner and then write a reflection individually.We were working effectively together as a group in work and suggestions to make the app better and better. However, when we were done with most of the app, Xavier decided to make an entire new app on his own time at home so we did not have as much say as we would have liked to on the final app.

3.  What Problem was your APP attempting to solve?  How well does it?  We have many features to our app but the main problem we wanted to solve was so make people remember what they had to do and with notepad not only can they type and save exactly what they wanted but they could name the button that exposes the task so you could find which note you wanted to see with key words.

4.  Desribe the two hardest challenges you experienced when coding this app.  How did you overcome them.  Post a screen shot of these sections of code, and explain them.One of the challenges I experienced was getting the app to perform the same task but with far simpler coding than we had before. The second problem we ran into was deciding exactly what features to use for the app.

5.  Given more time how could you improve your app?If we had more time we could have added more features such as the rating feature for the app so people can see others' opinions.




Jack Tremblay, Alex Place, Xavier Vogel