The Java Program: TPK.java
1
2
3 import java.util.Scanner;
4 import static java.lang.Math.*;
5
6 public class TPK {
7
8
9 static double f (double x) {
10 return sqrt (abs(x)) + 5.0 * pow(x,3.0);
11 }
12
13 public static void main (String args[]) {
14 final double A[] = new double[11];
15 final Scanner scan = new Scanner (System.in);
16
17
18 for (int i=0; i<A.length; i++) {
19 A[i] = scan.nextDouble ();
20 }
21
22
23 for (int i=A.length-1; i>=0; i--) {
24 final double y = f (A[i]);
25 if (y > 400.0) {
26 System.out.format ("%d TOO LARGE%n", i);
27 } else {
28 System.out.format ("%d %f%n", i, y);
29 }
30 }
31 }
32 }