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]
4 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]4 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
Cathy designed a website for a cereal brand. When users view the website, their eyes first fall on the brand name, then they vie
katrin2010 [14]

Hey there!

I would say the answer to this question is <u>Movement</u>.

If you look at the principles of design the definition of Movement is <u>Movement is the path the viewer's eye takes through the work of art, often to focal areas.</u>

In Cathy's design, it states that when viewers view her website their eyes first fall on the brand name, and then they view the bright images on the page.

Based on the information given you can conclude that the design principle that Cathy used was <u>Movement</u>.

I hope this helps,

Have a great day!

<u></u>

4 0
3 years ago
Isabela completes her presentation and delivers it during class.
elena-14-01-66 [18.8K]

Answer:

Slide show view and F5

Explanation:

7 0
3 years ago
Read 2 more answers
Write a program that asks the user to enter a person’s age. The program should display a message indicating whether the person i
MariettaO [177]

Answer:

The c++ program for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {

   int age;

   string person;

   cout << "This program prints whether the person is an infant, a child, a teenager or an adult based on the age entered by the user." << endl;

   cout << "Enter the age in completed years" << endl;

   cin >> age;

   if( age>=0 && age<=1 )

       person = "infant";

   else if( age>1 && age<13 )

       person = "child";

   else if( age>=13 && age<20 )

       person = "teenager";

   else

       person = "adult";        

   cout << "The person is " << person << " at the age of " << age << endl;

   return 0;

}

OUTPUT

This program prints whether the person is an infant, a child, a teenager or an adult based on the age entered by the user.

Enter the age in completed years

1

The person is infant at the age of 1  

Explanation:

This program prints the phase of the human life based on the age entered by the user. The program executes as follows.

1. User is prompted to enter the age in completed years. The program does not validates the user inputted age since it is not specifically mentioned in the question.

2. An integer variable, age, is declared which is initialized to the age entered by the user.

3. A string variable, person, is declared which is initialized to the phase of the person based on the entered age. The variable person is not initialized.

4. The age of the user is tested using multiple if else statements. Based on the age criteria given in the question, the variable person is assigned a value. This value represents the phase of the person which is equivalent to the age.

5. The program terminates with a return statement since the main method has the return type of integer.

3 0
3 years ago
25 pts! If programmers cannot write an algorithm because the problem is too complex, which methodology can they use to reach an
Setler [38]

Answer:

D, most likely thats what I was taught .

3 0
4 years ago
Melissa and Sue want to show a presentation to twenty employees using a presentation while using a projector. They learn that th
postnew [5]
C maybe ? I’m not positive about that though so sorry if I’m wrong
6 0
4 years ago
Read 2 more answers
Other questions:
  • In memory ads for DIMMs, you notice DDR 2400 CL15 in one ad and PC4 21300 CL9 in another. Which ad is advertising the faster mem
    12·1 answer
  • Technician A says that as volume decreases, pressure increases. Technician B says that as temperature increases, pressure decrea
    5·1 answer
  • which of these should be reportable diseases to protect public health? A. Obesity B. Diabetes C.Measles D. Lung Cancer
    10·2 answers
  • If you inadvertently rename a file that is associated with certain apps, the apps may not be able to find the file and may not r
    7·2 answers
  • Which two statements give good definitions of financial credit
    8·1 answer
  • An outline is most like which of the following?
    6·2 answers
  • En su cuaderno o carpeta de trabajo realice la conversión del sistema de numeración binario a octal según este ejemplo de manera
    13·1 answer
  • A remediation liaison makes sure all personnel are aware of and comply with an organization's policies.
    9·1 answer
  • Select the education and qualifications that are most helpful for Insurance Services careers. Check all that apply.
    14·2 answers
  • Can someone help me to write a python code to save list form python to CSV file please?​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!