Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class Mooshak {
- 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.ordenar();
- atleta.imprime();
- }
- }
- class Atleta {
- private String nome;
- private int[] tempos = new int[5];
- public Atleta(String nome, int[] tempos) {
- this.nome = nome;
- for (int i = 0; i < tempos.length; i++) {
- this.tempos[i] = tempos[i];
- }
- }
- public String getNome() {
- return nome;
- }
- public void ordenar() {
- Arrays.sort(tempos);
- }
- public void imprime() {
- System.out.print(getNome());
- for (int temp : tempos) {
- System.out.print(" " + temp);
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement