1. SUMMARY
  1. Using Java’s Generics framework, make two classes… one that stores 2 items of any given type (Pair) and one that stores 3 items of any given type (Triple). Then use the triple value class to store the win & loss records of multiple football teams (or any sport) in an array. Next loop through array and calculate the winning percentage of each team and add team name and win % to a pair class, and then add that instance to another array. Finally print out all team entries in the pair array with their win percentages and state which team has the greatest win percentage.
  1. This lab will involve the following new features:
    1. Generics
  1. DETAILS
  1. Generic classes: You’ll make two classes similar to what we did in class.
    1. One class is the Pair class just like from class, and the other will be a Triple class and will have one more parameter, so A,B,C in the Triple class.
  2. In your main class, you will create at least 5 instances of the Triple class, and in each one you will store:
    1. Team name – String
    2. Wins – int
    3. Losses – int
  3. Create an array of this Triple generic class type and store these 5 instances in the array.
    1. Here is a guide on creating an array of generic types:

Triple<String,Integer,Integer>[] aoTriple;

aoTriple = new Triple[5];

  1. Now create another array of Pair type that is 5 in length.
  2. Create a for loop and loop through the Triple array.
    1. For each item, calculate the win percentage and create new Pair object and place following values in each Pair object:
      1. Team name – String
      2. Winning percentage – double (e.g. .67) – this has to be calculated as opposed to just typing it into code!
        1. NOTE: Winning percentage has to be calculated by dividing wins by total games and can just be stored as a decimal… e.g. .85
  3. Print out results:
    1. Finally create a for loop to loop through Pair array and print out the values of each object (team name and win %).
    2. IMPORTANT: Also print out which team has the highest win % by figuring out mathematically which % is the highest.
Looking for solution of this Assignment?

WHY CHOOSE US?

We deliver quality original papers

Our experts write quality original papers using academic databases.We dont use AI in our work. We refund your money if AI is detected  

Free revisions

We offer our clients multiple free revisions just to ensure you get what you want.

Discounted prices

All our prices are discounted which makes it affordable to you. Use code FIRST15 to get your discount

100% originality

We deliver papers that are written from scratch to deliver 100% originality. Our papers are free from plagiarism and NO similarity.We have ZERO TOLERANCE TO USE OF AI

On-time delivery

We will deliver your paper on time even on short notice or  short deadline, overnight essay or even an urgent essay