would like help with this. Please include explanation and properly space the code. (beginner code only). I
Fantastic news! We've Found the answer you've been seeking!
Question:
would like help with this. Please include explanation and properly space the code. (beginner code only). I had an expert help with this code but It had indenting errors and was not basic. thank you for your help
Transcribed Image Text:
EnterANumberBetwee5And10 Write a public class call EnterANumberBetwee5 And10 with a main method. what it does: 1. prompt user for a number (see examples) 2. read from user 3. if the user didn't enter a number go to step 1 4. if the user didn't entered a number between 5 and 10 (inclusive) go to step 1 5. otherwise print: "you entered a valid number" followed by the number (see examples) Restrictions: do not use anything we haven't covered in class. HINT: we wrote a similar programs in slides 29 and 30 of ch06. Never use System.err.print. Always use System.out.print or println because this is a loop that expects certain inputs if your program doesn't read the inputs described here you may get a "your program took too long" error. That means the logic of your program is wrong. Examples % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): a a is not a number enter a number between 5 and 10 (inclusive): hello hello is not a number enter a number between 5 and 10 (inclusive): 4 you entered a bad number enter a number between 5 and 10 (inclusive): 5.6 you entered a valid number: 5.6 % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): 9 you entered a valid number: 9.0 % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): 20 you entered a bad number enter a number between 5 and 10 (inclusive): 7 you entered a valid number: 7.0 % EnterANumberBetwee5And10 Write a public class call EnterANumberBetwee5 And10 with a main method. what it does: 1. prompt user for a number (see examples) 2. read from user 3. if the user didn't enter a number go to step 1 4. if the user didn't entered a number between 5 and 10 (inclusive) go to step 1 5. otherwise print: "you entered a valid number" followed by the number (see examples) Restrictions: do not use anything we haven't covered in class. HINT: we wrote a similar programs in slides 29 and 30 of ch06. Never use System.err.print. Always use System.out.print or println because this is a loop that expects certain inputs if your program doesn't read the inputs described here you may get a "your program took too long" error. That means the logic of your program is wrong. Examples % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): a a is not a number enter a number between 5 and 10 (inclusive): hello hello is not a number enter a number between 5 and 10 (inclusive): 4 you entered a bad number enter a number between 5 and 10 (inclusive): 5.6 you entered a valid number: 5.6 % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): 9 you entered a valid number: 9.0 % java EnterANumberBetween5And10 enter a number between 5 and 10 (inclusive): 20 you entered a bad number enter a number between 5 and 10 (inclusive): 7 you entered a valid number: 7.0 %
Expert Answer:
Answer rating: 100% (QA)
a Java program that prompts the user to enter a number between 5 and 10 and ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Jen and Berry's sells ice-creams from its factory-shop in Petone. There is a managing director (Maynard Dibble), a marketing manager (Mary Salman) and a production manager (Peter Pritchard). Maynard...
-
Let a population consist of the values 9 cigarettes, 10 cigarettes, and 20 cigarettes smoked in a day (based on data from the California Health Interview Survey). Assume that samples of two values...
-
Through Internet research, update the information in Figure 17.12. Find out which countries have joined the euro area recently or are likely to join soon. Why are these countries joining while others...
-
Medical gamma imaging is generally done with the technetium isotope \({ }^{99} \mathrm{Tc}^{*}\), which decays by emitting a gammaray photon with energy \(140 \mathrm{keV}\). What is the mass loss of...
-
Nurally Inc. manufactures a single product. Selected data from the companys cost records for two recent months are given below: The companys manufacturing overhead cost consists of both variable and...
-
Consider the use of 10,000-bit frames on a 2-Mbps satellite channel with a 270- ms delay. What is the maximum link utilization for sliding window flow control * ?with a window size of 127 127/541 0...
-
1. Show the impact of the real required rate of return (1) declining to 0.025 in the short run (SR), intermediate run (IR) and the long run (LR) R SR IR LR Q Pa
-
How does digital art respond to the challenges of archiving, preserving, and exhibiting digital artworks in an age marked by rapid technological obsolescence, digital decay, and the ephemeral nature...
-
Determine the major ethical issues created by the mergers of public accounting firms with non-CPA firms that perform accounting services. Discuss the departures from generally accepted accounting...
-
Auditors have to make judgments concerning materiality on every audit. Since the auditing standards give no formal guidance for how to determine materiality, auditors must rely on their own...
-
The following table shows the one-year return distribution of Startup, Inc. Calculate a. The expected return. b. The standard deviation of the return. Probability 40% 20% 20% 10% 10% Return -100%...
-
How does the democratization of digital tools and online platforms for creative collaboration empower artists from diverse backgrounds to engage in global dialogues, challenge hegemonic narratives,...
-
Which of the following is NOT normally regarded as being a good reason to establish an ESOP? a. To help prevent a hostile takeover. b. To make it easier to grant stock options to employees. c. To...
-
3.16. For a system with non-identical service rates (see Sect. 3.5) and a limit of N jobs in the system (Eq. 3.13), obtain an expression for the mean service time per job, E[Ts], as a function of the...
-
On February 2, 2012, Alexandra purchases a personal computer for her home. The computer cost $3,000. Alexandra uses the computer 80 percent of the time in her accounting business, 10 percent of the...
-
Yolanda earns $112,000 in 2012. Calculate the FICA tax that must be paid by: Yolanda:.....................Soc.Sec..................$__________...
-
Lisa Sizemore, a taxpayer in the 10-15 percent tax bracket, purchased stock as an investment on July 11, 2011. She sold the stock on July 9, 2012, 2 days before qualifying for the long-term holding...
-
In recent years, Keflavik Paper Company has been having problems with its project management process. Several commercial projects, for example, have come in late and well over budget, and product...
-
Your firm has the opportunity to invest $75,000 in a new project opportunity but due to cash flow concerns, your boss wants to know when you can pay back the original investment. Using the discounted...
-
Pracht, a popular cosmetics company in Germany, has been performing favorably and growing at a constant rate, with profits exceeding $900,000 in the last financial year. The company now wants to...
Study smarter with the SolutionInn App