Skip to content

Instantly share code, notes, and snippets.

View douglasiacovelli's full-sized avatar

Douglas Iacovelli douglasiacovelli

  • @contratadome
  • Bertioga
View GitHub Profile
class Cinema {
public static int contador = 0;
public static double lhama(double tarifa,int idade ,boolean deficiencia ,boolean estudante ,boolean homem){
if (deficiencia == true ){
tarifa = tarifa*0;
}
else{
@douglasiacovelli
douglasiacovelli / MatrizEsp
Created May 13, 2012 04:39
Matriz Espiral
public class MatrizEsp{
public static void main(String[] args){
int A [][] = new int [25][25];
int cont = 1;
int sup = 0;
int dir = 0;
int inf = 0;
int esq = 0;
int metade = A.length / 2;
for(int passadas = 0; passadas < metade; passadas++) {
class Teste{
public static void main (String args[]) {
int linhas = 30;
//int pontos = 2*linhas+1;
//escreve as linhas
for (int i = 0;i<linhas;i++){
int pontos = 2*i+1;
//escreve os epaços
for(int space=0;space<(linhas-(i+1))*2;space++){
System.out.print(" ");
/*
Fernanda Moraes, Yuri M., Anselmo S., Marcos P..
* Definir uma maneira de indicar o estado inicial dos navios dos jogadores;
* Exibir todos os movimentos dos jogadores, informando se os ataques foram bem sucedidos ou não;
* Informar quando um navio é atingido e quando ele é afundado;
* Exibir ao final do jogo um mapa final do posicionamento final dos navios dos jogadores.*/
@douglasiacovelli
douglasiacovelli / index.html
Created January 10, 2014 17:32
HTML: Template
<!doctype html>
<html lang="pt-br">
<head>
<title> </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/index.css">
import java.util.*;
public class PerceptronSimples{
public static void main(String[] args){
/**
* Dados correspondem ao problema AND
*/
@douglasiacovelli
douglasiacovelli / BasicAdapter.java
Last active April 13, 2017 17:45
Basic Adapter with dataBinding
class AdapterName extends RecyclerView.Adapter<AdapterName.ViewHolder> {
private Contract contract;
private List<T> data;
public AdapterName(Contract contract, List<T> data) {
this.contract = contract;
this.data = data;
}
Observable.just("Will")
.observeOn(Schedulers.io())
.flatMap({ name ->
updateUserName.execute(name) //returns another Observable<ApiResult> after calling the API
})
.subscribe({ apiResult ->
//what if you want to use the name here again to update the local cache for example if
//everything goes right with the API?
})
class FormActivity: AppCompatActivity {
onCreate(...){...}
fun sendFormAndGoBack(name: String) {
// if you want to send any type of data back, such as an object, string, int etc
// you have to create an intent and use this bit of code
// otherwise you can just use setResult(Activity.RESULT_OK) and finish()
val resultIntent = Intent()
class ListActivity: AppCompatActivity {
private val REQUEST_FORM = 1
onCreate(...){...}
fun startFormActivity() {
val intent = Intent(this, FormActivity::class.java)
startActivityForResult(intent, REQUEST_FORM)
}