exercicio

master
250406 2025-11-13 15:52:57 +00:00
commit 687177e594
2 changed files with 41 additions and 0 deletions

13
pom.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>for_s</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>24</maven.compiler.release>
<exec.mainClass>com.mycompany.for_s.For_s</exec.mainClass>
</properties>
</project>

View File

@ -0,0 +1,28 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package com.mycompany.for_s;
import java.util.Scanner;
/**
*
* @author 250406
*/
public class For_s {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
for(int i = 0; i < 12; i++){
System.out.println("Introduza o valor da fatura "+(1 +1));
double valor = scanner.nextDouble();
soma += valor
}
double media = soma / 12;
System.out.println("A média das faturas é " + media);
}
}