3. Write a Java program that first asks the user how many numbers will be entered...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Write a Java program that first asks the user how many numbers will be entered - let's call this positive integer n. Then the program takes input ʼn integers (not ordered) and outputs how many even values and how many odd values have been entered. Input control: the input should be restricted to only integers between 0 and 100. SAMPLE OUTPUT: How many numbers in input? 10. Now enter 10 integers: 123 ERROR! Valid range 0 - 100. REENTER: 1 2 3 129 ERROR! Valid range 0 - 100. REENTER: 4 5 6 7 176 ERROR! Valid range 0 - 100. REENTER: 8 9 10 You entered 5 odd numbers and 5 even numbers. 3. Write a Java program that first asks the user how many numbers will be entered - let's call this positive integer n. Then the program takes input ʼn integers (not ordered) and outputs how many even values and how many odd values have been entered. Input control: the input should be restricted to only integers between 0 and 100. SAMPLE OUTPUT: How many numbers in input? 10. Now enter 10 integers: 123 ERROR! Valid range 0 - 100. REENTER: 1 2 3 129 ERROR! Valid range 0 - 100. REENTER: 4 5 6 7 176 ERROR! Valid range 0 - 100. REENTER: 8 9 10 You entered 5 odd numbers and 5 even numbers.
Expert Answer:
Answer rating: 100% (QA)
Youve provided an image that contains instructions for writing a Java program along with sample outp... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
A sex-selective abortion is an abortion in which a woman terminates a pregnancy merely because of the sex of the fetus, of then because the fetus is a female. This often happens in countries where...
-
1. For each of the variables listed in the table below, indicate: the type of variable - quantitative discrete, quantitative continuous or qualitative, and the level of measurement for the variable -...
-
9.1 Exercise (JDK Source Code): Extract the source code of the class Math from the JDK source code ("$JAVA_HOME" "src.zip" "Math.java" under folder "java.lang"). Study how constants such as E and...
-
Let a function f be the line graph connecting the data points (1, 2), (4,9), and (6,3). (a) Write the formula for a piecewise-linear function f that passes through these data points whose domain is 1...
-
Euro-Medi Plc manufactures a wide range of medical instruments. Two testing instruments (101 and 201) are produced at its highly automated Limerick plant. Data for December 2015 are as follows:...
-
A uniform magnetic field directed upward exists in some region of space. In what direction(s) could an electron be moving if its trajectory is (a) A straight line? (b) A circle? Assume that the...
-
Which item(s) appears as a reconciling item(s) to the bank balance in a bank reconciliation? a. Outstanding checks b. Deposits in transit C. Both a and b d. None of the above
-
Rob and Laura wish to buy a new home. The price is $300,000 and they plan to put 25% down. New Rochelle Savings and Loan will lend them the remainder at 8% per annum, compounded semi-annually for a...
-
Polyfield Manufacturing prepares their annual budgets at the beginning of the year along with a mid-year update in June for any changes in estimates or business conditions. When the budget was...
-
Food scientists have created a new oil. At room temperature, the oil is a liquid. As the oil gets colder however, it stiffens (thickens) into a sticky gel. To explore the properties of the oil, the...
-
Use the Internet to research foreign corporation branch profits tax and effectively connected income issues in the United States. Imagine you are a CPA and your foreign client with U.S. operations...
-
The MoMi Corporation's cash flow from operations before interest and taxes was $2.4 million in the year just ended, and it expects that this will grow by 5% per year forever. To make this happen, the...
-
Compare the advantages and disadvantages of using a Dutch Auction to a traditional underwriting method for an IPO. Identify one real-life IPO that occurred in 2020. (Not Airbnb) For this one IPO,...
-
Sales Electric division $8,100,000 Gasoline division $16,200,000 COGS (Costs of Goods Sold) Electric division $2,970,000 Gasoline division $7,830,000 Allocated Overhead Electric division $945,000...
-
Estimating the stock value. (10 marks) Using the Discounted dividend model (DDM) estimate the intrinsic value of the firms' stocks using the following steps: Estimate the dividend growth rate using...
-
(c) Identify the four (4) advantages of mass customization and examine with appropriate examples, how supermarkets may employ Pine and Gilmore's four (4) mass customization to create value for their...
-
2.0 g of benzoic acid dissolved in 25.0g of benzene shows a depression in freezing point equal to 1.62K. Molal depression constant (K) of benzene is 4.9 K.kg.mol-. What is the percentage association...
-
The Zwatch Company manufactures trendy, high-quality moderately priced watches. As Zwatch's senior financial analyst, you are asked to recommend a method of inventory costing. The CFO will use your...
-
Write a Java program that serves as a primitive web browser. For this assignment it merely needs to input a server name and display the HTML that is sent by the web server. A web server normally...
-
Write a JavaFx application that draws a bulls-eye pattern. The center should be a filled-in blue circle with a diameter of 100 pixels. The center circle should be surrounded by five rings that...
-
Derive a class BuyNItemsGetOneFree from DiscountPolicy, as described in Exercise 10. The class should have a constructor that has a single parameter n. In addition, the class should define the method...
-
What are the different ways digital technology advancements disrupt the audit function?
-
How can digital technology transform financial reporting from static information provision to active engagement?
-
Identify four changed accounting roles and activities as a result of digital technology advancements.
Study smarter with the SolutionInn App