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
pickupchik [31]
2 years ago
14

Use a switch statement to display "one" if the user has entered 1, "two" if the user has entered 2, and "three" if the user has

entered 3. If a number other than 1, 2, or 3 is entered, the program should display an error message: "Enter one of the numbers - 1, 2, or 3."
Computers and Technology
1 answer:
astra-53 [7]2 years ago
4 0

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter one the numbers - 1, 2, or 3.");

       int num = in.nextInt();

       switch (num){

           case 1:

               System.out.println("one");

               break;

           case 2:

               System.out.println("two");

               break;

           case 3:

               System.out.println("three");

               break;

           default:

               System.out.println("Error");

       }

   }

}

Explanation:

  • Using Java Programming Language
  • User Scanner Class to prompt, receive and store user's input
  • Use a switch statement with three cases as required by the question to output one, two or three
  • Use the default statement to handle any other case
You might be interested in
To determine why a computer program started to function differently, Mel should most likely use data to
Amiraneli [1.4K]

Answer:

convince the software company of the issue

Explanation:

3 0
3 years ago
Read 2 more answers
What is the difference between ‘’ and “” string type in python?
Mekhanik [1.2K]

Answer:

There is no difference between ‘’ and “” string type in python. Both are used to hold the string or sequence of character in the python. triple """ """ can also use for the same.

Example:

str1 = "aeiou"

str2 = 'aeiou'

str3 =""" hello"""

print(type(str1), type(str2),type(str3))

<class 'str'> <class 'str'> <class 'str'>

Here all are used to hold string or sequence of character.

6 0
3 years ago
What is the space complexity of the algorithm?ArithmeticSeries(list, listSize) { i = 0 arithmeticSum = 0 while (i &lt; listSize)
blondinia [14]

Answer:

O(n) which is a linear space complexity

Explanation:

Space complexity is the amount of memory space needed for a program code to be executed and return results. Space complexity depends on the input space and the auxiliary space used by the algorithm.

The list or array is an integer array of 'n' items, with the memory size 4*n, which is the memory size of an integer multiplied by the number of items in the list. The listSize,  i, and arithmeticSum are all integers, the memory space is 4(3) = 12. The return statement passes the content of the arithmetic variable to another variable of space 4.

The total space complexity of the algorithm is "4n + 16" which is a linear space complexity.

7 0
2 years ago
Proszę daje wszystko potrzebuje tego
Stolb23 [73]
I’m sorry I do not speak that
5 0
3 years ago
Read 2 more answers
A window frame will expand to fill the entire desktop when you
natima [27]
A. Sometimes it is marked by outwards pointing arrows (<= =>) with the reverse (collapsing so as to not take up the whole screen) being in the same spot, marked by inwards arrows (=> <=)
8 0
2 years ago
Other questions:
  • 99 points!!! What would happen to the document if the change “A” is pointing to was accepted? a. There would be no changes. b. “
    6·2 answers
  • Problems and Exercises 16 through 43 are based on the entire ("big" version) Pine Valley Furniture Company database. Note: Depen
    13·1 answer
  • What is an identified component of a software program that might allow a hacker or other intruder to gain entry and control of a
    10·2 answers
  • The reason the Code uses the term ____ instead of motor is that, in many instances, the motor is inside an enclosure and is out
    12·2 answers
  • Fact about energy that will make a knex car move
    7·2 answers
  • Ohanians “great big secret” is that:
    8·1 answer
  • When planning the structure of a spreadsheet, columns are for _______ items and rows are for _______ items.
    10·2 answers
  • Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the cou
    8·1 answer
  • This feature in Word Online allows you to view your document to see what it will look like when printed.
    6·2 answers
  • The _____ layer addresses how the software will execute on specific computers and networks.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!