Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Not yet answered Marked out of 12.50 Assume the following tester code (see Figure 1) is in the main class that produces the

image text in transcribed

Question 1 Not yet answered Marked out of 12.50 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 "1" as shown in the sample output run below (see Figure 2) Tester Code (Figure 1): public static void main(String[] args) { Integer[] ages = {16, 70, 15, 40, 3, 22); Double[] scores = {85.7, 38.9, 72.75, 64.9, 15.3, 99.6); String[] persons = { "Hamed", "Zinab", "Amal", "Naif", "Khalid"); //call generic method ismin 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.5? " + isMin(scores, 15.5)); System.out.print ("Scores: "); present (scores); System.out.println(" "); //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(" } //end 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 Zinab Amal 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 to Expert-Tailored 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

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

What is the derivative of g(x) = -4 4 -4x 4x = -4x?

Answered: 1 week ago