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
lozanna [386]
3 years ago
7

Complete the AscendingAndDescending application so that it asks a user to enter three integers. Display them in ascending and de

scending order.An example of the program is shown below:Enter an integer... 1 And another... 2 And just one more... 3 Ascending: 1 2 3 Descending: 3 2 1GradingWrite your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade.Once you are happy with your results, click the Submit button to record your score.
Computers and Technology
1 answer:
Andreas93 [3]3 years ago
5 0

Answer:

Following are the solution to the given question:

import java.util.Scanner;//import package

public class AscendingAndDescending//defining a class AscendingAndDescending  

{

   public static void main(String[] args) //main method

   {

       int n1,n2,n3,min,max,m;

       Scanner in = new Scanner(System.in);//creating Scanner class object

       System.out.print("Enter an integer: ");//print message

       n1 = in.nextInt();//input value

       System.out.print("And another: ");//print message

       n2 = in.nextInt();//input value

       System.out.print("And just one more: ");//print message

       n3 = in.nextInt();//input value

       min = n1; //use min variable that holds value

       max = n1; //use mix variable that holds value

       if (n2 > max) max = n2;//use if to compare value and hols value in max variable

       if (n3 > max) max = n3;//use if to compare value and hols value in max variable

       if (n2 < min) min = n2;//use if to compare value and hols value in min variable

       if (n3 < min) min = n3;//use if to compare value and hols value in min variable

       m = (n1 + n2 + n3) - (min + max);//defining m variable that arrange value

       System.out.println("Ascending: " + min + " " + m + " " + max);//print Ascending order value

       System.out.println("Descending: " + max + " " + m + " " + min);//print Descending order value

   }

}

Output:

Enter an integer: 8

And another: 9

And just one more: 7

Ascending: 7 8 9

Descending: 9 8 7

Explanation:

In this program inside the main method three integer variable "n1,n2, and n3" is declared that inputs value from the user end and also defines three variable "min, max, and m" that uses the conditional statement that checks inputs value and assigns value according to the ascending and descending order and prints its values.

You might be interested in
Which decimal number is equivalent to the hexadecimal number F1?
Papessa [141]

Answer:

C

Explanation:

8 0
2 years ago
List 5 ways that computers could be used in a school or university
larisa [96]

Answer:

Explanation:

✓ computer can be used Interactive Learning apps, whereby students can share knowledge

✓Access to Information on the go: computer can be searched when educational information is needed

✓Virtual Classrooms : Incase of online classroom computer can be of help where both teacher student can meet online

✓Data processing and presentation ; computer can be used by both teacher and student in processing of data's.

✓Computer Literacy Education : for Literacy Education, computer can be used in training students to become computer literate.

4 0
3 years ago
What are the reasons why organizations opt for a certificate
Nata [24]

Answer:

Because it helps you prove that you're you to third parties who wouldn't know otherwise. A CA helps you to establish trust with others because they're trusted for issuing valid, reliable certificates — and that trust is integral to public key infrastructure (PKI).

Explanation:

with this info I believe it is a A and C

6 0
2 years ago
A(n) ____ algorithm is a set of specific, sequential steps that describe in natural language exactly what a computer program mus
Paul [167]
<span>The answer is algorithm, because computer programmers need a programming language that's more similar to their native language. They then write specific steps a computer must take to complete the task at hand. Machine code is not easily memorized and is foreign to most people.</span>
8 0
3 years ago
Which access database object is best to use for the basis of a report when specific criteria must be applied to the report?
Anna007 [38]
The answer is Query.

A query helps a user retrieve specific items from a MS Access database. If you have an item that matches with all the criteria you enter, it shows in the query results. A query is sent to the data source to retrieve the data.




8 0
2 years ago
Read 2 more answers
Other questions:
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • My current lesson is The Excel Screen and Worksheets and the question is:
    6·1 answer
  • 7. Which innovation in video games do you think has been most significant? Include at least one way that innovation affects the
    6·1 answer
  • The Universal Containers research lab is publishing its latest research into knowledge articles assigned to the data category "C
    15·1 answer
  • 1.) A ____ is a piece of information.
    10·1 answer
  • Katarina is deciding whether to buy a desktop or a laptop computer. What will most likely help Katarina make her decision?
    10·2 answers
  • Rolulzoss<br>A. State three positive uses of computers in the government sector​
    10·1 answer
  • HELP FAST
    14·1 answer
  • Notice that the percentages range from just over 55% to just under 65%. This is a range of 10%, so we're going to use 5 evenly-s
    6·1 answer
  • To break a text string into several lines, which means that the text string continues on the next line, the _____ character shou
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!