This file contains hidden or 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
/* | |
* Dado x números entre 0 e 100, apresente a média, o maior e o menor número digitado. | |
* Caso o usuário digite um número diferente do solicitado no intervalo, | |
* peça para informar outro número. | |
*/ | |
package cap14; | |
import java.util.Scanner; | |
public class Exercicio07 { |
This file contains hidden or 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
/* | |
* Digite X números e informe quantos números pares/ímpares foram digitados. | |
*/ | |
package cap14; | |
import java.util.Scanner; | |
public class Exercicio08 { | |
public static void main(String[] argss){ | |
Scanner ent = new Scanner(System.in); |
This file contains hidden or 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
/* | |
* Construir um programa em java que faça a leitura | |
* de 10 números e os imprima na ordem inversa que foram lidos | |
*/ | |
package vetores; | |
import java.util.Scanner; | |
public class Exercicio01 { | |
public static void main(String[] args){ |
This file contains hidden or 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
/* | |
* Declare um vetor de 10 posições | |
* preencha com os 10 primeiros números ímpares | |
* escreva na tela o resultado | |
*/ | |
package vetores; | |
public class Exercicio02 { | |
public static void main(String[] args){ |
This file contains hidden or 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
/* | |
* Faça um programa em java que faça a leitura de X temperaturas | |
* calcule a temperatura média | |
* contabiliza quantas temperaturas estão acima da média | |
*/ | |
package vetores; | |
import java.util.Scanner; | |
public class Exercicio03 { |
This file contains hidden or 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
/* | |
* Leia um vetor de 20 posições | |
* leia um valor X qualquer | |
* Faça uma busca de X no vetor | |
* informe a posição do vetor que X foi encontrado | |
* ou diga que não foi encontrado | |
*/ | |
package vetores; | |
import java.util.Scanner; |
This file contains hidden or 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
/* | |
* Leia um vetor de N posições | |
* leia dois valores x e y | |
* procure os valores armazenados nos índices x e y do vetor | |
* imprima a soma destes valores | |
*/ | |
package vetores; | |
import java.util.Scanner; |
This file contains hidden or 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
### abstract data type - ADT | |
### specifies a set of methods and what they do, but not its implementation | |
## | |
### -> the stack ADT = a collection/data structure with mutiple elements | |
##""" a ADT is defined by its interface: the operations/methods that | |
## can be performed on it """ | |
## | |
### interface of a stack: | |
##__init__ = initialize a new empty stack | |
##push = add a new item to the stack |
This file contains hidden or 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
def censor(text, word): | |
"""takes two strings 'text' and 'word' as input and | |
returns the text with the word you chose replaced | |
with asterisks.""" | |
import string # we're going to use split and join built-in functions | |
# first of all, we need to break the words into a list | |
text = string.split(text) | |
# now, we iterate over the list index |
This file contains hidden or 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
/* objetos */ | |
// literal notation | |
var calendar = { | |
name: "PHP Event", | |
year: 2012 | |
}; | |
// constructor | |
var pets = {}; | |
// OU |