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]
3 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]3 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]3 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
Write a program that uses nested loop or for statements to display Pattern A below, followed by an empty line and then another s
JulsSmile [24]

Answer:

public class Pyramid {

   public static void main(String[] args) {

             int h = 7;

       System.out.println("Pattern A");

               for(int i = 1; i <= h; ++i)

               {

                   for(int j = 1; j <= i; ++j) {

                       System.out.print("+");

                   }

                   System.out.println();

               }

       System.out.println();

       System.out.println("Pattern B");

               for (int i = 1; i<=h; ++i)

               {

                 for(int j = h; j >=i; --j){

                     System.out.print("+");

                 }

                   System.out.println();

               }

           }

       }

Explanation:

  • The trick in this code is using a nested for loop
  • The outer for loop runs from i = 0 to the heigth of the triangle (in this case 7)
  • The inner for loop which prints the (+) sign runs from j = 0 to j<=i
  • It prints the + using the print() function and not println()
  • In the pattern B the loop is reversed to start from  i = height
8 0
3 years ago
What mobile operating system below requires all applications to be reviewed and approved before they can be made available in th
FinnZ [79.3K]

Answer:

The correct answer to the following answer will be iOS.

Explanation:

The iOS formerly stands for iPhone Operating System, basically is a mobile operating system developed by Apple Inc. This edition mainly supports Apple devices such as iPhone, iPod touch, iPad, etc.

Just because of this iOS gives the improvement to the entire application and is one of the operating systems which requires all that applications to be approved before showing availability in the App stores.

So, iOS is the right answer.

4 0
4 years ago
it says i have brainly plus subscripton but whenever i log onto brainly using my laptop, it says i don't have brainly plus and w
Sladkaya [172]

Answer:

Explanation:

I think you can try logging out from your account. Try cancelling your subscription. Before you do that, reach out to Brainly support.

4 0
3 years ago
Write a program for Horizon Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minu
Anarel [89]

Answer:

mport java.util.Scanner;

public class CellPhoneService

{

    public static void main (String args[])

    {

         Scanner sc=new Scanner(System.in);

         System.out.println("Enter the Talk minutes");

         int talkmin=sc.nextInt();

         System.out.println("Enter the text message");

         int textmsg=sc.nextInt();

         System.out.println("Enter the Gigabyte Data");

         int gbdata=sc.nextInt();

         if(talkmin<500 && textmsg==0 && gbdata==0)

         System.out.println("PLAN A IS RECOMMENDED FOR THIS USER at 49$ per month");

         else if(talkmin<500 && textmsg>0 && gbdata==0)

         {

              System.out.println("PLAN B IS RECOMMENDED FOR THIS USER at 55$ permonth");

         }

         else if(talkmin>=500 && textmsg<100 && gbdata==0)

         {

              System.out.println("PLAN C IS RECOMMENDED FOR THIS USER at 61$ permonth");

         }

         else if(talkmin>=500 && textmsg>=100 && gbdata==0)

         {

              System.out.println("PLAN D IS RECOMMENDED FOR THIS USER at 70$ permonth");

         }

         else if(gbdata>0 && gbdata<2)

         {

              System.out.println("PLAN E IS RECOMMENDED FOR THIS USER at 79$ permonth");

         }

         else if(gbdata>=2)

         {

              System.out.println("PLAN F IS RECOMMENDED FOR THIS USER at 87$ permonth");

         }

    }

}

Explanation:

  • Take the talk minute and text message as input from user.  
  • Apply the conditional statement to check if talk minute is less than 500 along with text message and GB data having a value 0.
  • At last check if GB data is greater than or equal to 2, then print the relevant response.
3 0
3 years ago
Pls help I will mark you the brainliest
ehidna [41]

Answer:

c

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • How do computers find servers, requests information from the server, and receives it?
    12·1 answer
  • What should be included as part of the approval process? in relation to computer forensics
    14·1 answer
  • What tasks do most operating systems perform?
    15·1 answer
  • How do i make spaces in python<br> To draw hello world
    15·1 answer
  • g Write a function named vowels that has one parameter and will return two values. Here is how the function works: Use a while l
    9·1 answer
  • Selection Sort List the resulting array after each iteration of the outer loop of the selection sort algorithm. Indicate the num
    10·1 answer
  • Imagine that you just received a summer job working for a computer repair shop one of your first task is to take apart a compute
    14·1 answer
  • What is my mistake on this code? (Python)
    9·1 answer
  • Explain the concepts of GIGO—garbage in, garbage out. Why do you think it’s a helpful concept in coding? How do you think it can
    8·1 answer
  • The _________________ creates international guiding principles for computer forensic examiners.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!