This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int countBlocks(int levels) { | |
int total = 0; | |
for (int i=1; i<=levels; i++){ | |
total = total + (i*i); | |
} | |
return total; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Roll a Yahtzee | |
public int keepRolling() { | |
int dice1 = rollDice(); | |
int dice2 = rollDice(); | |
int dice3 = rollDice(); | |
int dice4 = rollDice(); | |
int dice5 = rollDice(); | |
int count = 1; | |
while (!(dice1 == dice2 && dice2 == dice3 && dice3 == dice4 && dice4 == dice5)) { | |
//we need to re-roll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Implicit intent | |
public void submitOrder(View view) { | |
Intent intent = new Intent(Intent.ACTION_SENDTO); | |
intent.setData(Uri.parse("mailto:justjava@justjavacoffee.com")); // only email apps should handle this | |
intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.order_summary_email_subject, name)); | |
intent.putExtra(Intent.EXTRA_TEXT, priceMessage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
Brazilian Portuguese Localization file for Android App Just Java | |
path: res/values-pt-rBR/strings.xml | |
--> | |
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | |
<string name="hello_world">Olá Mundo!</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count = 3 | |
print "Ok." | |
while (count > 0): | |
print count | |
count = count - 1 | |
print "Let's Jam!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print("#########################################") | |
print("Let's play Rock, Paper Scissors!") | |
print("##########################################\n\n") | |
startGame = input("Shall we start?(y/n)\n") | |
while startGame == "y": | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.android.trucopaulistacounter; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity { | |
int scoreDuoOne = 0; |