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...
-
A block is pressed against a vertical wall by a force , as the drawing shows. This force can either push the block upward at a constant velocity or allow it to slide downward at a constant velocity....
-
1. Bhatt claimed to have met all of the requirements to acquire a strip of public land through adverse possession. Which element did the court find had not been met? Why? 2. What is the "potential...
-
The equation of state for a certain gas is given by \(P(V-(\mathrm{b})=R T\), where \(b\) is a positive constant. The Joule-Thomson coefficient of this gas would be (a) + ve (b) - ve (c) Zero (d)...
-
Ialani Corp. uses a job order costing system for the yachts it constructs. On September 1, 2010, the company had the following account balances: Raw Material Inventory ........ $332,400 Work in...
-
A rope exerts a force of magnitude 750N at an angle 35 degrees above the horizontal, on a cow at rest on a horizontal floor. The coefficient of static friction between the cow and the floor is 0.50....
-
Grain is being added to a silo. At time t=0, the silo is empty. The rate at which grain is being added is modeled by the differentiable function g, where g(t) is measured in cubic feet per minute for...
-
1. You have an opportunity to invest $104,000 now in return for $79,900 in one year and $29,100 in two years. If your cost of capital is 9.2%, what is the NPV of this investment? The NPV will be $ 2....
-
A 400-gram football is moving in the positive x-direction with a speed of 7 m/s. Cristiano Ronaldo hits the ball with his head and sends it in the opposite direction with a speed of 15.5 m/s. Find...
-
An animal can jump with a speed of 1 0 . 8 m / s and typically leaps at an angle of 2 9 degrees. How far does the animal jump on level ground and what is it's maximum height above the ground. Answer...
-
Osage Inc. has actual sales for May and June and forecast sales for July, August, September, and October as follows: Actual: May 5,830 units June 6,280 units Forecast: July 5,930 units August 6,870...
-
A surveyor uses a steel tape measure that is 5 0 . 0 0 0 meters long at a temperature of 2 0 . 0 degrees C . When it is a hot summer day the temperature is 3 5 . 0 degrees Celsius. What is the length...
-
Teri Hatcher Inc., in its first year of operations, has the following differences between the book basis and tax basis of its assets and liabilities at the end of 2019. Book Basis Tax Basis Equipment...
-
The following spreadsheet contains monthly returns for Cola Co. and Gas Co. for 2013. Using these data, estimate the average monthly return and the volatility for each stock. (Click on the following...
-
Differentiate. y = ln(3x + 1) ln(5x + 1)
-
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...
-
What is thermodynamics?
-
An astronaut weighs \(800 \mathrm{~N}\) on the earth's surface where the acceleration of gravity is \(g=9.83 \mathrm{~m} / \mathrm{s}^{2}\). The mass and the radius of the moon are \(7.4 \times...
-
Explain the scope and limitations of thermodynamics.
Study smarter with the SolutionInn App