EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

Question
Book Icon
Chapter 5, Problem 2PE
Program Plan Intro

Ascending and descending order

Program plan:

  • Import necessary package.
  • Create a class “AscendingAndDescending”,
    • Define the method “main ()”,
      • Declare the necessary variables.
      • Create “Scanner” object.
      • Prompt the user to enter three integers.
      • Get three integers from the user using “nextInt()”.
      • Check whether the first integer is less than or equal to the remaining integers,
        • If it is true, assign the first integer to “low1”.
        • Check whether the second integer is less than or equal to the third integer,
          • If it is true, assign the second integer to medium.
          • Assign the third integer to “high1”.
        • Otherwise,
          • Assign the third integer to “medium”.
          • Assign the second integer to “high1”.
      • Otherwise,
        • Check whether the second integer is less than or equal to the remaining integers,
          • If it is true, assign the second integer to “low1”.
          • Check whether the first integer is less than or equal to third integer,
            • If it is true, assign the first integer to “medium”.
            • Assign the third integer to “high1”.
              • Otherwise,
                • Assign the third integer to “medium”.
                • Assign the first integer to “high1”.
        • Otherwise,
          • Assign the third integer to “low1”.
          • Check whether the first integer is less than or equal to second integer,
            • If it is true, assign the first integer to “medium”.
            • Assign the second integer to “high1”.
              • Otherwise,
                • Assign the second integer to “medium”.
                • Assign the first integer to “high1”.
      • Print the integers in ascending order.
      • Print the integers in descending order.

Blurred answer
Students have asked these similar questions
I need to develop and run a program that prompts the user to enter a positive integer n, and then calculate the value of n factorial n! = multiplication of all integers between 1 and n, and print the value n! on the screen. This is for C*.
I need to develop and run a C* program to sum up integers from 1 to 100, and print out the sum value on the screen. Can someone help please?
Given the schema below for the widgetshop, provide a schema diagram. Schema name Attributes Widget-schema Customer-schema (stocknum, manufacturer, description, weight, price, inventory) (custnum, name, address) Purchased-schema (custnum, stocknum, pdate) Requestedby-schema (stocknum, custnum) Newitem-schema (stocknum, manufacturer, description) Employee-schema (ssn, name, address, salary) You can remove the Newitem-schema (red).
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning