exercicios do teste
parent
ef3ac35501
commit
96b6aee7f8
|
|
@ -240,21 +240,28 @@ public class Mavenproject29 {
|
|||
// }
|
||||
// }
|
||||
|
||||
// Scanner scanner = new Scanner(System.in);
|
||||
// double soma = 0;
|
||||
// double maiorFatura = 0;
|
||||
// int mes = 0;
|
||||
// for (int i = 0; i < 12; i++){
|
||||
// System.out.println("Introduza o valor da fatura " + (i + 1));
|
||||
// double valor = scanner.nextDouble();
|
||||
// soma += valor;
|
||||
// if(valor > maiorFatura){
|
||||
// maiorFatura = valor;
|
||||
// mes = i + 1;
|
||||
// }
|
||||
// }
|
||||
// System.out.println("A soma das faturas é " + soma);
|
||||
// System.out.println("O mês com a maior fatura foi " + mes);
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
double soma = 0;
|
||||
double maiorFatura = 0;
|
||||
int mes = 0;
|
||||
for (int i = 0; i < 12; i++){
|
||||
System.out.println("Introduza o valor da fatura " + (i + 1));
|
||||
double valor = scanner.nextDouble();
|
||||
soma += valor;
|
||||
if(valor > maiorFatura){
|
||||
maiorFatura = valor;
|
||||
mes = i + 1;
|
||||
}
|
||||
System.out.println("Introduza um número");
|
||||
int numero = scanner.nextInt();
|
||||
for(int i = 1; i < 11; i++){
|
||||
System.out.println(numero + " x " + i + " = " + (numero * i));
|
||||
}
|
||||
System.out.println("A soma das faturas é " + soma);
|
||||
System.out.println("O mês com a maior fatura foi " + mes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue