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
To close the header or footer, you should press the ________ key(s) on your keyboard.
STatiana [176]
C. Esc
Try it for yourself if you want :)
6 0
3 years ago
PLEASE HURRY!!<br> Look at the image below
djverab [1.8K]

Answer:

The function usernameMaker.

Explanation:

strFirst is a local variable in the function usernameMaker since it is an argument that is passed into that function. This means that the scope of strFirst is the function usernameMaker, since it cannot be accessed anywhere else in the code.

Hope this helps :)

8 0
3 years ago
What is a 'balanced' dfd?
jasenka [17]

Answer:

 The balanced DFD (Data flow diagram) is the concept of the balancing all the state and incoming and also outgoing flow in the system.

The balanced data flow diagram basically ensure that the output and input data flow maintain the consistency in the DFD and are properly aligned the flow of data.

A balanced DFD does not include any type of flowchart in the control statement and also does not contain any crossing lines.

8 0
4 years ago
What are the benefits of writing functions that use parameters and return? Try to list at least two.
lana66690 [7]

Answer:

Explanation:

Writing functions that use parameters and return helps improve code readability and manages complexity by reusing code.

6 0
3 years ago
Write a program that calculates and displays the amount ofmoney available in a bank account that initially has $8000 deposited i
Leviafan [203]

Answer:

Written in Python

import math

principal = 8000

rate = 0.025

for i in range(1, 11):

    amount = principal + principal * rate

    principal = amount

    print("Year "+str(i)+": "+str(round(amount,2)))

Explanation:

This line imports math library

import math

This line initializes principal amount to 8000

principal = 8000

This line initializes rate to 0.025

rate = 0.025

The following is an iteration from year 1 to 10

for i in range(1, 11):

    This calculates the amount at the end of the year

    amount = principal + principal * rate

    This calculates the amount at the beginning of the next year

    principal = amount

    This prints the calculated amount

    print("Year "+str(i)+": "+str(round(amount,2)))

6 0
4 years ago
Other questions:
  • Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the
    8·1 answer
  • Ben is accessing his bank account using online banking. What protocol in the URL lets him know that the website is secure and en
    13·1 answer
  • Create a Flash Card class. Flash Cards have a Question and an Answer, each of which are Strings. Your class should include a con
    6·1 answer
  • What are the only things that can be declared in an interface?
    11·1 answer
  • Where does communication take place?
    12·1 answer
  • your computer running Windows 10 is doing some very strange things with operating system you are fairly certain it is not a hard
    13·2 answers
  • Is phone data used when connected to wifi
    12·1 answer
  • Which staff member takes a set of plans and supervises their construction?
    6·1 answer
  • :|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|:|
    5·2 answers
  • Databases containing the research, writing and studies conducted by Academic
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!