Instructions:
Squares.java

Write a recursive JavaFX program which inputs through a GUI an integer. It then calls a recursive function to draw a box of that size and then recursively calls itself to draws a box of size-5 until size is

3 GUI

3 Recursive draw function

2 Documentation

Median.java

Write a complete java program which includes a function using generics with this declaration:

public static > E median(E[] values) { … }

A median is the middle most of a sorted list. The array passed to the method is not necessarily sorted. Normally if the number of elements is even, the two middlemost are averaged together. In our case we will just opt of the larger of the two. Notice the input is a simple array not a list. Calling the method should not change the values in the array.

Demonstrate its correctness by finding the median of a list of Strings, Integers and Doubles.

public static void main (String s[]) { Integer iArray[]={10,11,20,-5,23,64,210}; Double dArray[]={19.2,1.1,2.5,-291.3,-312.1,81.23,99.57}; String sArray[]={“Fortran”,”Algol”,”Cobol”,”C++”,”Perl”,”Java”,”Pilot”,”Ruby”}; String tricky[]={“Will it work on a single value?”}; System.out.printf(“Median of %s is %d\n”,Arrays.toString(iArray),median(iArray)); System.out.printf(“Median of %s is %f\n”,Arrays.toString(dArray),median(dArray)); System.out.printf(“Median of %s is %s\n”,Arrays.toString(sArray),median(sArray)); System.out.printf(“Median of %s is %s\n”,Arrays.toString(tricky),median(tricky)); }

With the output of

Median of [10, 11, 20, -5, 23, 64, 210] is 20
Median of [19.2, 1.1, 2.5, -291.3, -312.1, 81.23, 99.57] is 2.500000
Median of [Fortran, Algol, Cobol, C++, Perl, Java, Pilot, Ruby] is Java
Median of [Will it work on a single value?] is Will it work on a single value?