Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TesteTipo2 {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- Atleta atleta = new Atleta(sc.next(), new int[] { sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt() });
- atleta.imprime();
- }
- }
- class Atleta {
- private String nome;
- private int[] tempos = new int[5];
- private int total_tempo = 0;
- public Atleta(String nome, int[] tempo) {
- this.nome = nome;
- for (int temp : tempo) {
- this.tempos = tempo;
- }
- }
- public String getNome() {
- return nome;
- }
- public int getTotal() {
- for (int total : tempos) {
- total_tempo += total;
- }
- return total_tempo;
- }
- public void imprime() {
- System.out.println(getNome() + " " + getTotal());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement