/***************************************************************** * Program 0: Hello World * Programmer: Insert your name here * * Due Date: * Class: COMP 14-002 Instructor: Joshua Stough * * Pledge: I have neither given nor received unauthorized aid * on this program. (signature on file) * * Description: This program prints out a greeting to the world. * * Input: None * * Output: A friendly greeting * * Questions: * 1) What was the result of compiling after you deleted the * curly brace ({)? * * 2) What was the result of compiling after you deleted the * semicolon? * * 3) Add an additional double quote (") inside the * "Hello world!". what is the resultant compile? ******************************************************************/ import java.text.*; public class Hello_World { public static void main(String[] args) { System.out.println ("Hello World!"); int [] a = new int[1000]; for (int i = 0; i < a.length; i ++) a[i] = i + 1; System.out.println("There are " + numPerfSq(a) + " perfect squares in the array."); } public static int numPerfSq(int [] a) { int c = 0; for (int i = 0; i < a.length; i ++) { if (Math.sqrt( a[i]) == Math.floor(Math.sqrt( a[i]))) { System.out.print(a[i] + " " ); c ++; } } return c;///a.length; } public static int mystery(int first, int last) { if (first > last) return 0; else if (first == last) return first; else return first + mystery(first + 1, last - 1); } }