Páginas

terça-feira, 21 de maio de 2019

public static double

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package media;
import java.util.Scanner;
/**
 *
 * @author aluno
 */
public class Media {
   
    /**
     * @param args the command line arguments
     */
    public static double calcularMedia(double x, double y){
        return (x+y)/2;
   
   
    }
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner teclado = new Scanner(System.in);
        System.out.println("informe a primeira nota");
        double x = teclado.nextDouble();
        System.out.println("informe a segunda nota");
        double y = teclado.nextDouble();
        double media = calcularMedia(x,y);
        System.out.println("a media é "+media);
    }
}

Sem comentários:

Enviar um comentário