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
@startuml | |
skinparam classAttributeIconSize 0 | |
class Ponto { | |
-x: int = 0 | |
-y: int = 0 | |
+Ponto() | |
+Ponto(x: int, y: int) | |
+getX(): int |
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
@startuml | |
skinparam classAttributeIconSize 0 | |
class Circule { | |
-raio: double = 1.0 | |
-cor: String = "vermelho" | |
+Circulo() | |
+Circulo(raio: double) | |
+Circulo(raio: double, cor:String) | |
+getRaio(): double |
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
/*Desenvolva um aplicativo Java que receba como entrada os quilômetros | |
dirigidos e os litros de gasolina consumidos (ambos como inteiros) para cada viagem. | |
O programa deve calcular e exibir o consumo em quilômetros/litro para cada viagem e | |
imprimir a quilometragem total e a soma total de litros de combustível consumidos | |
até esse ponto para todas as viagens. Todos os cálculos de média devem produzir | |
resultados de ponto flutuante. Utilize classe Scanner e repetição controlada | |
por sentinela para obter os dados do usuário. | |
*/ | |
import java.util.Scanner; | |
// - Receber do usuário e analisar km percorridos e l de combustivel para cada viagem de carro. |
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
- Receber do usuário e analisar km percorridos e l de combustivel para cada viagem de carro. | |
- Inicializar variáveis | |
- inicializar km totais com 0 | |
- inicializar l totais com 0 | |
- inicializar contador de viagem com 1 | |
- Pedir para o usuário os km percorridos e os l de combustível gastos | |
- imprimir os dados de km total, l total e média de consumo por viagem | |
- faça |
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 class Account { | |
// Atributos / variáveis de instância | |
private String name; // variável de instância - ou atributo | |
// criar uma variável de instância do tipo double cujo nome é balance | |
private double balance; | |
// construtor | |
public Account(String name, double balance) { // inicializará a classe com um nome | |
this.name = name; | |
if (balance > 0) { |
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 exemplo; | |
import java.util.List; | |
public class Principal { | |
public static void main(String[] args) { | |
DatabaseAccess db = new DatabaseAccess(); |
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 exemplo; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.ArrayList; | |
import java.util.List; |
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 exemplo; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
import java.sql.Statement; | |
import java.util.ArrayList; | |
import java.util.List; |
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 exemplo; | |
public class Pessoa { | |
private int id; | |
private String nome; | |
private int idade; | |
public Pessoa() { } | |
public Pessoa(int id, String nome, int idade) { |
NewerOlder