Assume the following tester code (see Figure 1) is in the main class that produces the output shown in Figure 2 below. P

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Assume the following tester code (see Figure 1) is in the main class that produces the output shown in Figure 2 below. P

Post by answerhappygod »

Assume The Following Tester Code See Figure 1 Is In The Main Class That Produces The Output Shown In Figure 2 Below P 1
Assume The Following Tester Code See Figure 1 Is In The Main Class That Produces The Output Shown In Figure 2 Below P 1 (94.66 KiB) Viewed 41 times
With Explinaotin
justifay
isMin()
present()
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 "compareTo". • 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.52" + isMin(scores, 15.5)); System.out.print("scores: "); present (scores); System.out.println("- "); 7/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.75| 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)
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply