Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you solve this using two static generic methods 2 Assume the following tester code (see Figure 1) is in the main class that produces

can you solve this using two static generic methods
image text in transcribed
2 Assume the following tester code (see Figure 1) is in the main class that produces the output shown in Figure 2 below. Provide two static generic methods that are called by the main method shown below: .isMin.) generic method that takes an object value and an array of objects: the method checks and returns whether the given object equals to the smallest element value of the passed Array, Hint use Comparable interface of the standard Java library, where Comparable interface has a single method called "compare To .present.) generic method to print the passed Array elements separated by *** as shown in the sample output run below (see Figure 2) Tester Code (Figure 1): public static void main(string[args) { Integer] ages = 116, 70, 15, 40, 3, 22); Double') scores = 185.7, 38.9, 72.75, 64.9, 15.3, 99.6); String[] persons = { "Hamed", "Zinab", "Amal", "Nait", "Khalid"); V/call generic method is in to return answer System.out.println("The youngest person is 3 years old isMin (ages, 3)); System.out.print("Ages: "); present (ages); //call generic method to display array as shown in output sample System.out.println("-- -"); System.out.println("The lowest score is 15.52 " + ismin(scores, 15.5)); System.out.print("Scores: "); present (scores); System.out.println(" 1/Notice names are not sorted by considered alphabatically System.out.println("The first person in the list is Amal? " + isMin (persons, "Amal") System.out.print("Persons: "); present (persons); System.out.println(" llend main Sample output run (Figure 2): run: The youngest person is 3 years old? true Ages: 161 701 151 401 31 22 The lowest score is 15.5? false Scores: 85.71 38.91 72.751 64.91 15.31 99.6 The first person in the list is Amal? true Persons: Hamed Zinabi Amall Naif Khalid BUILD SUCCESSFUL (total time: 0 seconds) Paragraph

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions