Analyze complete the Java program that asks the user to enter a number between 1 and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Analyze complete the Java program that asks the user to enter a number between 1 and 3 and displays a message with the number. If an invalid number is entered an error message alerts the user: Invalid number entered. Use an If statement. Java Program: import java.util.*; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a number between 1 and 3: "); int number = scan.nextInt(); if (number==1) System.out.println("You entered 1 "); else if (number==2) سلم } ? } Analyze complete the Java program that asks the user to enter a number between 1 and 3 and displays a message with the number. If an invalid number is entered an error message alerts the user: Invalid number entered. Use an If statement. Java Program: import java.util.*; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter a number between 1 and 3: "); int number = scan.nextInt(); if (number==1) System.out.println("You entered 1 "); else if (number==2) سلم } ? }
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class Main public static void mainString args ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Jim deposits $14.9,000 annually into a life insurance fund for the next 6 years, at which time he plans to retire. Instead of a lump sum, Jim wishes to receive annuities for the next 23 years. What...
-
Why would an organization need to integrate an ERP? Why did the specific organization in your example want to integrate an ERP?
-
MFRS 12 firms require to disclose information that enables users of their financial statements to evaluate the effects of interests in other entities on their financial position, financial...
-
What does 'buying local' mean to you? How do you determine what 'local' means? Are there limits to buying local here in PEI? Is buying local a priority for you when making purchases? How do you...
-
The person in the drawing is standing on crutches. Assume that the force exerted on each crutch by the ground is directed along the crutch, as the force vectors in the drawing indicate. If the...
-
In the "All About You" feature in this chapter, you learned how important it is for companies to report or disclose information about all liabilities, including potential liabilities related to an...
-
Plaintiff contracted to install a boiler for defendant. After plaintiff had installed and tested the boiler, but before final payment to plaintiff had been made, defendant took custody of the boiler...
-
Taveras Co. decides at the beginning of 2008 to adopt the FIFO method of inventory valuation. Taveras had used the LIFO method for financial reporting since its inception on January 1, 2006, and had...
-
What is the output of this code? x=3 num = 17 print(num %x)
-
It's mid-December and Marie is finalizing her divorce. Generally, she and her soon to be ex-spouse have been amicable, and Marie is looking forward to being single. The divorce attorneys will be...
-
The management of Majengo Ltd. presented the following income statement of the company for the year ended 31 December 2019: Majengo Ltd Income Statement for the year ended 31 December 2019 Note Gross...
-
The following pseudocode illustrates the basic push () and pop () operations of an array- based stack. Assuming that this algorithm could be used in a concurrent environment, answer the following...
-
As you read Persepolis book 1 (ends with "The Dowry". You could read book 2 if you have the time!), notice how Marji is developing in this coming of age story. How would you describe her at the...
-
Read about circus logistics here: https://host.kelley.iu.edu/mabert/recent_pubs/pim_2010_no1.pdf Links to an external site. . Additionally, read the culture map article Links to an external site. ....
-
Read the conference paper "Pardon me--your personality is showing. The link is given below Summarize in your own words in 500 words what you read in the link provided and also write a conclusion for...
-
Consider how you would cater to the learning needs of a class of students in a teaching situation (choose a year level) and provide your multi-modal teaching pedagogy. Include connections to how you...
-
How many 6-element subsets of a = {0, 1, 2, 3, 4, 5, 6, 7, 89) have exactly three even elements? how many do not have exactly three even elements?
-
Determine which of the following limits exist. Compute the limits that exist. lim x-0 1- + 3x X
-
Suppose that you create two String objects: String name1 = new String("Jordan"); String name2 = new String("Jore"); The expression name1.compareTo(name2) has a value of ____________. a. True b. False...
-
Write a program for Horizon Phones, a provider of cellular phone service. Prompt a user for maximum monthly values for talk minutes used, text messages sent, and gigabytes of data used, and then...
-
You created a Die class from which you could instantiate an object containing a random value from 1 through 6. Now use the class to create a simple dice game in which the user chooses a number...
-
James Madison, the fourth President of the United States, was 163 cm tall. His height converts to the z score of -2.28 when included among the heights of all presidents. Is his height above or below...
-
Which do you think has less variation: the IQ scores of students in your statistics class or the IQ scores of a simple random sample taken from the general population? Why?
-
Carbon monoxide is measured in San Francisco on five different days, and the mean of those five values is 0.62 parts per million. Four of the values (in parts per million) are 0.3, 0.4, 1.1, and 0.7....
Study smarter with the SolutionInn App