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
allochka39001 [22]
4 years ago
9

Write the definition of a static method named isSorted that receives two arguments: an array of references to objects that imple

ment the Comparable interface and a boolean. If the boolean is true then the method returns true if the objects referenced in the array are in ascending order. On the other hand, if the boolean is false, the method returns true if the objects are in descending order. The method also returns true for arrays of 0 or 1 length. For all other situations, the method returns false
Computers and Technology
2 answers:
Dmitry [639]4 years ago
7 0

Answer:

public static boolean isSorted(Comparable[] x, boolean y)

{

boolean isAscending = true;

if (x.length == 0 || x.length == 1) return true;

else if (y) {

for (int i = 0; isAscending && i < x.length - 1; i++)

if (x[i].compareTo(x[i + 1]) > 0) isAscending = false; // descending

} else {

for (int i = 0; isAscending && i < x.length - 1; i++)

if (x[i].compareTo(x[i + 1]) < 0) isAscending = false; // ascending

}

return isAscending;

}

Explanation:

See answer

IgorC [24]4 years ago
5 0

Explanation:

Program:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace StaticMethods1

{

   class comparable

   { p=small object, m=medium object,  G=big object

       public static comparable  objects (int p, int m,g)

       {

           int s = p≤ m≤ g;

           true;

       }

       public static int Subtract (int P, int M,int G)

       {

           int r = p≥m≥g ;

           return r;

       }

   }

   class Program

   {

       static void Main (string [] args)

       {

           Console.Write ("comparable p ≤ m is");

           Console.WriteLine (comparable (p,≤ m));

           Console.Write ("comparable m≤g is");

           Console.WriteLine (comparable operacion (g≥m≥p));

           Console.ReadKey ();

You might be interested in
What is the meaning of ethics? Check all of the boxes that apply
suter [353]

Answer:

behavior that is good for everyone

following the rules

behaving in a way that would be easy to defend

Explanation:

6 0
3 years ago
What are examples of computer hardware? mouse, keyboard, motherboard, BIOS
inessss [21]

Answer:

Memory card, console, mouse, cooling system of your pc umm wht else keyboard charger,

Explanation:

3 0
3 years ago
Read 2 more answers
I really need help with this question
zhuklara [117]

teleconferencing is like zoom or skype you can be in a call with facetime.

3 0
3 years ago
A(n) ________ is software and/or hardware that monitors system and network resources and activities and notifies network securit
enyata [817]

Answer:

intrusion detection system

Explanation:

intrusion detection system

IDS or the intrusion detection system is the software and/or hardware system which can be used to monitor for detecting suspicious network activities and monitoring the system and notifying teams when there are attempts to break the secure network infrastructure.

5 0
4 years ago
Question # 2
stealth61 [152]

Answer:

An instance of a class cannot be changed after it is created. IS THE WRONG ONE. Everything else is right.

Explanation:

4 0
3 years ago
Other questions:
  • What is an example of an Internet access problem?
    15·2 answers
  • Write the definitions for three function named max. Each receives two parameters, of the same type, and returns the larger of th
    12·1 answer
  • Given that the variables x and y have already been declared and assigned values, write an expression that evaluates to true if x
    15·1 answer
  • What symbol following a menu command lets you know that a dialog box will be displayed? an arrow a check mark an ellipse a radio
    5·2 answers
  • Which word in brackets is most opposite to the word in capitals? PROSCRIBE (allow, stifle, promote, verify)​
    14·2 answers
  • If Word finds a potential error in a document, a red, green, or blue wavy underline flags the problem. True or False
    6·1 answer
  • A _________ is a component commonly used in an analog pressure gauge. Use letter keys to select choices A microprocessor B press
    8·1 answer
  • Cual
    5·1 answer
  • Software that allows users to use and adapt it for any purpose, often allowing the public to participate in further development
    7·2 answers
  • Which of the following online creation tools will be used if a person wants to create a video presentation?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!