From 5bc4282098042e88cac929a73c517e052648a471 Mon Sep 17 00:00:00 2001 From: 250406 <250406@localhost> Date: Wed, 19 Nov 2025 15:30:31 +0000 Subject: [PATCH] trabalhos --- pom.xml | 13 +++++++++ .../mycompany/exercicio12/Exercicio12.java | 29 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 pom.xml create mode 100644 src/main/java/com/mycompany/exercicio12/Exercicio12.java diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..cd1d042 --- /dev/null +++ b/pom.xml @@ -0,0 +1,13 @@ + + + 4.0.0 + com.mycompany + exercicio12 + 1.0-SNAPSHOT + jar + + UTF-8 + 24 + com.mycompany.exercicio12.Exercicio12 + + \ No newline at end of file diff --git a/src/main/java/com/mycompany/exercicio12/Exercicio12.java b/src/main/java/com/mycompany/exercicio12/Exercicio12.java new file mode 100644 index 0000000..5a9545d --- /dev/null +++ b/src/main/java/com/mycompany/exercicio12/Exercicio12.java @@ -0,0 +1,29 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + */ + +package com.mycompany.exercicio12; + +import java.util.Scanner; + +/** + * + * @author 250406 + */ +public class Exercicio12 { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + double soma = 0; + for(int i = 0; i < 12; i++){ + System.out.println("Introduza as faturas de eletrecidade no ano"); + double fatura = scanner.nextDouble(); + soma += fatura; + } + double media = soma / 12; + System.out.println("a media das faturas é " + media); + + } +} + \ No newline at end of file