1answer.
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
natta225 [31]
4 years ago
15

Create a class called Minimum that provides a single class method min. min should take an array of any object that implements Co

mparable and return the minimum value from the array, using compareTo to compare object instances. So the function signature of min should be public static Comparable min(Comparable[] values) As a reminder, first.compareTo(second) returns a positive value if first is larger than second, a negative value if first is smaller than second, and O if they are equal. Note that the array of Comparable references passed to min will all be the same type and contain no null references. However, the array may be null or empty in which case you should return nul1 Note that the warning about unchecked or unsafe operations is normal and not a sign that you did something wrong. We'll discuss this soon in class.) Minimum.java
Computers and Technology
1 answer:
kaheart [24]4 years ago
7 0

Answer:

The required code is given below:

Explanation:

public class Minimum {

   public static Comparable min(Comparable[] values) {

       if (values == null || values.length == 0) {

           return null;

       } else {

           Comparable minValue = values[0];

           for (int i = 0; i < values.length; i++) {

               if (values[i].compareTo(minValue) < 0) {

                   minValue = values[i];

               }

           }

           return minValue;

       }

   }

}

You might be interested in
Enrico waited ten years to file a cause of action against Frederico for a breach of contract claim. Frederico can use ______ as
ser-zykov [4K]
Time, due to the amount of time between the initial action and the filing of the report, federico could claim the it didn't happen or something
3 0
3 years ago
Write a while loop that prints userNum divided by 2 (integer division) until reaching 1. Follow each number by a space.
Ksenya-84 [330]

Answer:

   while(userNum>=1){

       System.out.print(userNum/2+" ");

       userNum--;

        }

Explanation:

This is implemented in Java programming language. Below is a complete code which prompts a user for the number, receives and stores this number in the variable userNum.

<em>import java.util.Scanner;</em>

<em>public class TestClock {</em>

<em>    public static void main(String[] args) {</em>

<em>    Scanner in = new Scanner (System.in);</em>

<em>        System.out.println("Enter the number");</em>

<em>    int userNum = in.nextInt();</em>

<em>    while(userNum>=1){</em>

<em>        System.out.print(userNum/2+" ");</em>

<em>        userNum--;</em>

<em>         }</em>

<em>    }</em>

<em>}</em>

The condition for the while statement is userNum>=1 and after each iteration we subtract 1 from the value of   userNum until reaching 1 (Hence userNum>=1)

3 0
3 years ago
Help me with this two questions please
AnnyKZ [126]

Answer:

1 is def... don't know about the other one though sorry

6 0
2 years ago
Raul looks at different technologies that will help him do his job. What part of the process is this?
umka2103 [35]

This process is known as analyzing options. When Raul looks over different options and/or technologies that will help him do his job, he is going over the different options and seeing which option is best for him. When deciding which is best for him, he will need to consider: what Raul needs it to complete, how each technology option compares to the next, the price point and all of the functions the technology can do. After he figures out what it can do compared to what purpose he needs it to serve, he can determine the best option for himself.

5 0
4 years ago
What is the difference between the Paste Special and Paste Link options?
kotegsom [21]
Paste Link lets you automatically update the referenced document.
8 0
4 years ago
Read 2 more answers
Other questions:
  • Under the common criteria, which term describes the user-generated specifications for security requirements?
    12·1 answer
  • 2. Identify the diagram and define it.<br>13. What are pollen grains ?<br>4. What is an embryo?​
    12·1 answer
  • Where does most of the work in creating a presentation will take place? Either formatting toolbar, normal (Slide) view, slide so
    12·2 answers
  • Write the code to declare a variable to hold the value of the grade you hope to get in this class. What stdio.h input function w
    13·1 answer
  • Which leader of the Jamestown colony am I?
    15·2 answers
  • A(n) ________ is an information system that works across national borders, facilitates communication between headquarters and su
    14·1 answer
  • Design the program that reads two files and compares their contents. The program calls a method that reads the file one line at
    10·1 answer
  • Tyler is feeling overwhelmed by the programming assignment from his supervisor and wants to break the task down into smaller, mo
    5·2 answers
  • State four reasons why office automation is adopted in business establishment?​
    7·1 answer
  • What is one way object-oriented programming differs from procedural programming?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!