L09a

Due by the end of this meeting

Starter Files:


SUBMIT   /   Submission Summary

Restricted Generic Types

Activity 1
Make a program called Activity1 with a method to check whether an int[] is sorted. Test it with the following code:
System.out.println(isSorted(new int[]{1, 4, 4, 5})); System.out.println(isSorted(new int[]{10, 15, 15, 18, 19, 18, 25}));

Your output should be

true false
Activity 2
Make a program called Activity2 with a method to check whether an array of any sortable type is sorted. Test it with the following code:
System.out.println(isSorted(new Person[]{new Person("Alex"), new Person("Bina"), new Person("Djenaba"), new Person("Chris")})); System.out.println(isSorted(new Student[]{new Student("Fester"), new Student("Gomez"), new Student("Morticia"), new Student("Pugsley"), new Student("Wednesday")}));

Your output should be

false true
Your grade will be based on the following rubric:

Submit this/these files:


SUBMIT   /   Submission Summary