- import java.text.DecimalFormat;
- import java.util.Scanner;
- public class JPA01 {
- public static void main(String args[]){
- System.out.println("Please input:");
- Scanner scanner = new Scanner(System.in);
- float x = scanner.nextInt();
- float y = scanner.nextInt();
- float z = scanner.nextInt();
- float Average = (x+y+z)/3;
- DecimalFormat df = new DecimalFormat("#.##");
- String AVG = df.format(Average);
- System.out.print("Average:"+AVG);
- }
- }
複製代碼 |