answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Semenov [28]
2 years ago
7

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 of Section 10.1.2.
Computers and Technology
1 answer:
Gnesinka [82]2 years ago
5 0

Answer:

Explanation:

The following code is written in Java. It is hard to fully create the code without the rest of the needed code including the T class and the Measurable interface. Regardless the following code can be implemented if you have that code available.

 public static T minmax(ArrayList<T> mylist) {

       T min = new T();

       T max = new T();

       for (int x = 0; x < mylist.size(); x++) {

           if (mylist.get(x) > max) {

               max = mylist.get(x);

           } else if (mylist.get(x) < min) {

               min = mylist.get(x);

           }

       }

       

       return (min, max);

   }

You might be interested in
You are a high school student learning about computers and how to build them. As a class project, you have built a new computer.
Anon25 [30]

Answer:

You can use thermal paste, active heat sink, liquid pipes, and even a fan. These are just some that I've heard.

Explanation:

All of these are cooling and will stop the Central Processing Unit from overheating.

Hope this helps :)

5 0
1 year ago
Janice is unsure about her future career path she has grown up on her family farm but she is also interested in medicine Janice
KiRa [710]
Janice can actually used both knowledge as an advantage. She can use her background in farming while learning more about medicine. In such a way, she can have a strong advantage in medicinal farming - like learn ways to create good and effective drugs from plants, etc. 
5 0
2 years ago
Picture an expensive item you’d LOVE to own. What would make you happier: Buying it NOW using credit/taking out a loan? Buying i
dezoksy [38]

Answer:Buying Later

Explanation: Buying later would be the better choice because not only will you feel reawrded for working hard to get what you want but you also will not have to o throught the hassle of getting a loan. It may also be cheeper becuae many loans charge interest.

5 0
2 years ago
Describe a strategy for avoiding nested conditionals. Give your own example of a nested conditional that can be modified to beco
harina [27]

Answer:

One of the strategies to avoid nested conditional is to use logical expressions such as the use of AND & operator.

One strategy is to use an  interface class with a method. That method can be created to be used for a common functionality or purpose. This is also called strategy design pattern. You can move the chunk of conditional statement to that method. Then each class can implement that interface class and use that shared method according to their own required task by creating objects of sub classes and call that common method for any such object. This is called polymorphism.

Explanation:

Nested conditionals refers to the use of if or else if statement inside another if or else if statement or you can simply say a condition inside another condition. For example:

if( condition1) {  

//executes when condition1 evaluates to true

 if(condition2) {

//executes when condition1  and condition2 evaluate to true

 }  else if(condition3) {

 //when condition1 is true and condition3 is true

} else {

 //condition1  is true but neither condition2 nor conditions3 are true

}  }

The deeply nested conditionals make the program difficult to understand or read if the nested conditionals are not indented properly. Also the debugging gets difficult when the program has a lot of nested conditionals.

So in order to avoid nested conditionals some strategies are used such as using a switch statement.

Here i will give an example of one of the strategies i have mentioned in the answer.

Using Logical Expressions:

A strategy to avoid nested conditionals is to use logical expressions with logical operators such as AND operator. The above described example of nested conditionals can be written as:

if(condition1 && condition2){  //this executes only when both condition1 and condition2 are true

} else if(condition1 && condition3) {

this executes only when both condition1 and condition3 are true

} else if(condition1 ){

//condition1  is true but neither condtion2 nor condtion3 are true  }

This can further be modified to one conditional as:

if(!condition3){

// when  condition1 and condition2 are true

}

else

// condition3 is true

Now lets take a simple example of deciding to go to school or not based on some conditions.

if (temperature< 40){

  if (busArrived=="yes")   {

      if (!sick)       {

          if (homework=="done")           {

              printf("Go to school.");

          }

      }     

  }

}

This uses nested conditionals. This can be changed to a single conditional using AND logical operator.

if ((temperature <40) && (busArrived=="yes") &&

(!sick) && (homework=="done"))

{    cout<<"Go to school."; }

6 0
2 years ago
Which statements describe best practices for aligning text? check all that apply
kiruha [24]

Answer: *use the last column for text with multiple lines.

*use an indent marker to indent the first line of a paragraph.

*use a table if text in multiple columns have multiple lines.

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • In three to five sentences, describe whether or not files should be deleted from your computer.
    13·2 answers
  • True or false words spelling and grammar check is always %100
    7·2 answers
  • PowerPoint is a visual aid for many speakers. Discuss some points to remember when adding text to a PowerPoint presentation. How
    13·1 answer
  • Mel is skilled in identifying the technical, economic, and organizational feasibility of software. In which phase of SDLC should
    13·1 answer
  • Write a method named lastFirst that accepts a string as its parameter representing a person's first and last name. The method sh
    13·1 answer
  • Company A is setting up a network of mostly Windows machines. Which networking file system protocol would you recommend for maxi
    5·1 answer
  • Given num_rows and num_cols, print a list of all seats in a theater. Rows are numbered, columns lettered, as in 1A or 3E. Print
    7·1 answer
  • Docker is focused on ______ containerization.
    7·1 answer
  • Draw a flowchart and write the algorithm to find even number between 1 to 50​
    7·1 answer
  • How can migrating to an enterprise platform solution help a business improve employee productivity?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!