Diablo Valley College Static Generic Method Java Project

P18.1 Write a static generic method PairUtil.minmax that computes the minimum and maximum elements of an array of type T and returns a pair containing the minimum and maximum value. Require that the array elements implement the Measurable interface.

public interface Measurable{ /** Computes the measure of the object. @return the measure */ double getMeasure();}

In class P18_1, test your method by providing an Array of Measurable elements and returning a

Pair containing min and max values.

Example:

Measurable (3)Measurable (5.5)Measurable (99.0)Measurable (1)

Output:

(1.0, 99.0)

P18.4 Make the Measurable interface into a generic class. Provide a static method that returns the largest element of an ArrayList, provided that the elements are instances of Measurable. Be sure to return a value of type T.

In class P18_4, supply a test case by instantiating Measurable elements, add them to an

ArrayList and return the largest element.

Example:Measurable (3)Measurable (6)Measurable (9)Output:Largest Element: 9

E22.7 Write a program WordCount that counts the words in one or more files. Start a new thread for each file. Also, the last active thread also prints a combined count. Use locks to protect the combined word count and a counter of active threads.For example, if you call

➢ java WordCount report.txt address.txt Homework.java

then the program might print

address.txt: 1052Homework.java: 445report.txt: 2099Combined Count: 3596

Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order