Fix order button

package com.example.android.justjava;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.TextView;

import java.text.NumberFormat;

public class MainActivity extends ActionBarActivity {

	int quantity = 2;
	
	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	public void increment(View view){
		quantity = quantity + 1;
		display(quantity);
	}

	public void decrement(View view){
		quantity = quantity - 1;
		display(quantity);
	}

	public void submitOrder(View view){
		displayPrice(quantity * 5);
	}

	private void display(int number){
		TextView quantityTextView = (TextView) findViewById(
			R.id.quantity_text_view);
		quantityTextView.setText("" + number);
	}

	private void displayPrice(int number){
		TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
		priceTextView.setText(NumberFormat.getCurrencyInstance().format(number));
	}
}
<LinearLayout xmlns:android="http://schemas.android."
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:paddingBottom="@dimen/activity_vertical"
	android:paddingLeft="@dimen/activity_horizontal"
	android:paddingRight="@dimen/activity_horizontal"
	android:paddingTop="@dimen/activity_vertical"
	android:orientation="vertical"
	tools:context=".MainActivity">

	<TextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginBottom="16dp"
		android:text="Quantity" 
		android:textAllCaps="true" />

 	<Button
   	 android:layout_height="48dp"
     android:layout_width="48dp"
     android:text="+"
     android:onClick="increment" />

	<TextView
		android:id="@+id/quantity_text_view"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:text="0"
		android:textSize="16sp"
		adnroid:textColor="@android:color/black" />

 	<Button
   	 android:layout_height="48dp"
     android:layout_width="48dp"
     android:text="-"
     android:onClick="decrement" />

	<TextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginTop="16dp"
		android:text="Price" 
		android:textAllCaps="true" />

	<TextView
		android:id="@+id/price_text_view"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginTop="16dp"
		android:text="$0"
		android:textSize="16sp"
		adnroid:textColor="@android:color/black" />

 	<Button
   	 android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:layout_marginTop="16dp"
     android:text="Order"
     android:onClick="submitOrder" />

</LinearLayout>

create and use variables

variable name java
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html

data type variable name = initial value
int numberOfCoffees = 2;
display(numberOfCoffees);
display(numberOfCoffees * 5);

DDMS stands for Dalvik Debug Monitor Server, and is a tool in Android to help you debug your app.
https://developer.android.com/studio/profile/ddms.html?utm_source=udacity&utm_medium=course&utm_campaign=android_basics
Debug, Crashes, Compile time error, Runtime error, System log, Stacktrace

debugging android studio
https://developer.android.com/studio/debug/index.html

int quantity = 2;
quantity = 3;
quantity = 4;
quantity = 5;

int quantity = 2;
quantity = quantity + 1;

Modify the button

Main Activity

package com.example.android.justjava;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	public void submitOrder(View view){
		display(1);
	}

	private void display(int number){
		TextView quantityTextView = (TextView) findViewById(
			R.id.quantity_text_view);
		quantityTextView.setText("" + number);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		// Inflate the menu; this adds items to the action
		getMenuInflater().inflate(R.menu.menu_main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item){

		int id = item.getItemId();

		if ( id == R.id.action_settings){

		}
	}
}

getting paste error
1. read the error message
2. compare to working code
3. undo
4. ask for help

git hub gist

	private void displayPrice(int number){
		TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
		priceTextView.setText(NumberFormat.getCurrencyInstance().format(number));
	}

User Input

Select views
-2 TextViews, 1 Button

Position views
-Use LinearLayout as parent ViewGroup for these 3 children view set LinearLayout orientation to be vertical

Style views
-Quanity header should be in all caps
-Quantity value should be in black font color
-Add spacing between views

activity_main.xml

<LinearLayout xmlns:android="http://schemas.android."
	xmlns:tools="http://schemas.android.com/tools"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:paddingBottom="@dimen/activity_vertical"
	android:paddingLeft="@dimen/activity_horizontal"
	android:paddingRight="@dimen/activity_horizontal"
	android:paddingTop="@dimen/activity_vertical"
	android:orientation="vertical"
	tools:context=".MainActivity">

	<TextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_marginBottom="16dp"
		android:text="Quantity" 
		android:textAllCaps="true" />

	<TextView
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:text="0"
		android:textSize="16sp"
		adnroid:textColor="@android:color/black" />

 	<Button
   	 android:layout_height="wrap_content"
     android:layout_width="wrap_content"
     android:layout_marginTop="16dp"
     android:text="Order" />

</LinearLayout>

button android
https://developer.android.com/reference/android/widget/Button.html

conversation list activity

Java file -> MainActivity.java

package com.example.android.justjava;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		// Inflate the menu; this adds items to the action
		getMenuInflater().inflate(R.menu.menu_main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item){

		int id = item.getItemId();

		if ( id == R.id.action_settings){

		}
	}
}

comments java
http://journals.ecs.soton.ac.uk/java/tutorial/getStarted/application/comments.html

Data Analysis Process

extract -> clean -> explore -> analyze -> share

Bar graphs, Histograms, Scatter plots
Geospatial plots, Choropleth, Cartogram, Small multiples, Box plots, violin plots
Strip charts

choosing a good chart
http://extremepresentation.typepad.com/blog/2006/09/choosing_a_good.html

Bullet graphs, Sparkline, Connected scatter plot, Kernel density estimate, Cycle plots
Using color, Color palettes, Sequential palettes, Diverging palettes, Palettes for qualitative data

lie factor = size of effect shown in graphic / size of effect in data

Affordances

Affordances
-right size
-flip it
-throw it
-hide behind it

conceptual model
signified

most interesting solution comes out most interesting question.

good conceptual model <-> inaffective conceptual model

Quantitative:Quantitative data are things you measure as numbers such as temperature, money, and the number of scratches from your cat. You can split quantitative data into two groups, continuous and discrete.

Qualitative:Qualitative data is descriptive information about things that can’t be quantified with numbers, like male/female and hair color. These are categorical data, data that indicates belonging to a category or group. Often you’ll want to group your data by the categories and compare them.

Representing data with visual elements
Dots, Lines, Bars, Color

function

func averageScore(firstScore: Double, secondScore: Double, thirdScore: Double){
	let totalScore = firstScore + secondScore + thirdScore
	print(totalScore/ 3)
	}
func nameOfFunction(/* parameters */) -> Type {
	var valueToReturn: Type
	return valueToReturn
}

func calculateTip(priceOfMeal: Double) -> Double {
	return priceOfMeal * 0.15
}

func isValidLength(password: String) -> Bool {
	if password.characters.count >= 8 {
		return true
	} else {
		return false
	}
}

func calculateTip(priceOfMeal: Double -> Double{
	return priceOfMeal * 0.15
	})

let priceOfMeal = 43,27

let tip = calculateTip(priceOfMeal: priceOfMeal)

what’s string about

let theTrueth = "Money can't buy me love."
theTruth.characters.count

var forwardString = "spoons"
var charactersReversed = forwardString.characters.reversed()

for character in charactersReversed {
	print ("\(character)")
}

let similarTruth = "can't buy me"
var birthdayCheer = "Happy Birthday!"
print(birthdayCheer)

var name = "Kate"
var customizedBirthdayCheer = "Happy Birthday, \(name)!"
print(customizedBirthdayCheer)
var doggyDiet = "Mia eats 10 lbs of dog food per month."

var dogName = "Zebedee"
var lbsPerMonth: Double = 25

doggyDiet = "\(dogName) eats \(lbsPerMonth)lbs of dog food per month"

print(doggyDiet)

var kilosInALb = 0.45
var metricDoggyDiet = "\(dogName) eats \(kilosInALb * lbsPerMonth)kilos of dog food per month"

print(metricDoggyDiet)
let monkeyString = "I saw a monkey."
let thiefString = "He stole my iPhone."

var monkeyStringWithEmoji = "I saw a *."
var thiefStringWithEmoji = "He stole my *."

var forwardString = "time"
var charactersReversed = forwardString.characters.reversed()

for character in charactersReversed {
	print("\(character)")
}

let numOfPennies = 567
let dollarInt = numofPennies/100
let dollarsAndCentsString = "$\(dollarInt).\(numOfPennies % 100)"

let monkeyString = "I saw a monkey."
let thiefString = "He stole my iPhone."
var sillyMonkeyString = monkeyString + "" + thiefString

replacingOccurences(of: with:)

sillyMonkeyString.contains("key")

Different types of variables

var petsAge = 12
var myMiddleInitial: Character = "A"
var numberOfWheels: Int = 4
var centimetersOfRainfall: Float = 5.5
var pi: Double = 3.14159265359
var letterOfTheDay: Character = "z"
var myFavoriteAnimal: String = "nudibranch"
var rainingOutside: Bool = true
let encouragement = "you can do it!"
var customizedEncouragement = "you can do it, stephanie!"
customizedEncouragement = "you can do it, Ryder!"

let birthYear = 2008
var currentYear = 2017
var age = currentYear - birthYear
currentYear = 2017
age = currentYear - birthYear

Names cannot contain whitespace characters, mathematical symbols, arrows and [a few other obscure characters].
Names must begin with an uppercase or lowercase letter A through Z, an underscore, or [a few other less common options].

let theTrue = "Money can't buy me love."

var characterPoorString = ""
let stringWithPotential = String()