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
Harrizon [31]
3 years ago
14

What order? (function templates) Define a generic function called CheckOrder() that checks if four items are in ascending, neith

er, or descending order. The function should return -1 if the items are in ascending order, 0 if the items are unordered, and 1 if the items are in descending order. The program reads four items from input and outputs if the items are ordered. The items can be different types, including integers, strings, characters, or doubles. Ex. If the input is:
Computers and Technology
1 answer:
vlabodo [156]3 years ago
8 0

Answer:

Explanation:

The following code was written in Java and creates the generic class to allow you to compare any type of data structure. Three different test cases were used using both integers and strings. The first is an ascending list of integers, the second is a descending list of integers, and the third is an unordered list of strings. The output can be seen in the attached image below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Order: " + checkOrder(10, 22, 51, 53));

       System.out.println("Order: " + checkOrder(55, 44, 33, 22));

       System.out.println("Order: " + checkOrder("John", " Gabriel", "Daniela", "Zendaya"));

   }

   public static <E extends Comparable<E>> int checkOrder(E var1, E var2, E var3, E var4) {

       E prevVar = var1;

       if (var2.compareTo(prevVar) > 0) {

           prevVar = var2;

       } else {

           if (var3.compareTo(prevVar) < 0) {

               prevVar = var3;

           } else {

               return 0;

           }

           if (var4.compareTo(prevVar) < 0) {

               return 1;

           }  else {

               return 0;

           }

       }

       if (var3.compareTo(prevVar) > 0) {

           prevVar = var3;

       }

       if (var4.compareTo(prevVar) > 0) {

           return -1;

       }

       return 0;

   }

}

You might be interested in
What will save you the most money when trying to reduce the cost of college
julia-pushkina [17]

most probably housing and food

6 0
3 years ago
Read 2 more answers
In the terms of OOP, in the microwave system, current time is a BLANK and change heat is a BLANK
otez555 [7]

Answer:

1. Data and 2. procedures or functions

Explanation:

The object in an object oriented programming comprises of data and the procedures, The data describes the object, and the procedures explains what that particular object can do. And that is a function and nothing else. We declare a data, and procedure or function. We then initialize the data through constructor. And finally we does the operation like here its change heat by defining a function for it. A function is first declared, then defined and finally called for getting the desired output.

4 0
3 years ago
How is modern technology developed? Explain.
vivado [14]

Answer:

Modern technology has developed

Explanation:

The development of technology may draw upon many fields of knowledge, including scientific, engineering, mathematical, linguistic, and historical knowledge, to achieve some practical result. ... For example, science might study the flow of electrons in electrical conductors by using already-existing tools and knowledge.

4 0
3 years ago
Read 2 more answers
Choose ALL guidelines listed below pertaining to fair use.
tino4ka555 [31]

Answer:

Introduction

As you write blog posts, you may find that you want to include images you find online. Or maybe you found a great piece of writing—a recipe, a story, or a review—that you want to highlight on your own blog. It's important to know that almost all of the content you find on the Web belongs to someone. Just because you can take images, text, and more from other sites doesn't mean it's right to do so—ethically or legally.

In this lesson, you'll learn about the copyright protections that apply to work posted online. You'll learn about the rules that determine which images and text you can use, and how you can use them. You'll also learn how to protect the content you create.

The laws discussed in this lesson are United States laws. No lawyer was involved in preparing this lesson. We are not legal experts, and this lesson should not be taken as legal advice.

Understanding copyright

Copyright is the legal concept that works—art, writing, images, music, and more—belong to the people who create them. According to copyright law, any original content you create and record in a lasting form is your own intellectual property. This means other people can't legally copy your work and pretend it's their own. They can't make money from the things you create either.

To use, copy, or change a copyrighted work, you need permission from the person who holds the copyright. This permission is called a license. Even though everyone has the right to require that others respect their copyright and ask permission to use their work, some people and organizations choose to license their content more freely. They do this by giving their work a Creative Commons license or by placing their work in the Public Domain.

6 0
3 years ago
Read 2 more answers
Discuss what technologies you might see in use at an enterprise. For example, where would you most likely see fiber-optic Ethern
kvv77 [185]

There are various connectivity technologies that we use to connect. They are Ethernet, Internet (Wireless Connection), Bluetooth, Wi-Fi and Cellular.

Explanation:

  • Ethernet is the direct connection among the devices that are located close to each other in a building. This is used for small scale enterprises.
  • Wi-Fi lets wireless connections among multiple devices without any physical connection. And it is most extensively used in most of the corporate companies.
  • Bluetooth is used to transfer the data from one device to the other when they are near.
  • Cellular is used to connect people across the globe. And it is used widely in every enterprises.
7 0
3 years ago
Other questions:
  • "Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequen
    5·1 answer
  • Which of the following might not exist in a URL?
    10·2 answers
  • Help with number 12 please!
    15·1 answer
  • What does it mean for a design to be content driven
    12·1 answer
  • the part of the computer that provides access to the internet is the A.modem B. keyboard C. monitor or D.system unit
    7·2 answers
  • How 0x86 processor store 0x12345678 in memory ​
    13·1 answer
  • Who is responsible for developing the physical background for the characters by creating buildings, landscapes, and interiors?
    14·1 answer
  • An enhancement to a computer accelerates some mode of execution by a factor of 10. The enhanced mode is used 50% of the time, me
    11·1 answer
  • Hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
    14·2 answers
  • Explica porque se afirma que la existencia de estaciones cambia las combstumbres y la cultura​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!