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...
-
Pro forma balance sheet Peabody & Peabody has 2015 sales of $10 million. It wishes to analyze expected performance and financing needs for 2017, which is 2 years ahead. Given the following...
-
A Community Hospital has two (2) service departments: Maintenance and Food Services. The hospital has three (3) patient care units, namely: General Medicine, OB, and Surgery. Additional information...
-
Review Amazon.coms audit report in Exhibit 1.7 and discuss what the report tells you about Amazons financial statements. Is there anything in the audit report that causes you concern? Why or why not?...
-
The trial balances before and after adjustment for Turnquist Company at the end of its fiscal year are presented below. Instructions Prepare the adjusting entries that weremade. TURNQUIST COMPANY...
-
Politicians, health care consultants, and health systems have ideas on steps that can be taken in the US to reduce the cost of pharmacy medications. Write letter to a politician, pharmacy company, or...
-
Elizabeth Burke wants to develop a model to more effectively plan production for the next year. Currently, PLE has a planned capacity of producing 9,100 mowers each month, which is approximately the...
-
the book Sybil is a detailed account of an individual with dissoactive identity disorder (formerly k own as multiple personality disorder). This would represent what type of design?
-
Cleaning supplies Electricity Maintenance Wages and salaries Depreciation Rent Administrative expenses per Month Fixed Cost Cost per Car Washed $ 0.80 $ 1,200 $ 0.15 $ 0.20 $ 5,000 $ 0.30 $ 6,000 $...
-
(a) Advanced Computer Sdn Bhd is involved in the manufacturing of computer network equipment. For the next month, the company estimated to make sales of 250 units computer network equipment totaling...
-
Record the effect, if any, of the transaction entry or adjusting entry on the appropriate balance sheet category or on the income statement by entering the account name and amount and indicating...
-
Find the general solution of y" +3y'+2y=4e
-
Cheyenne Company owns a 7.200-acre tract of timber purchased in 2006 at a cost of $1.352 per acre. At the time of purchase, the land was estimated to have a value of $312 per acre without the timber....
-
Plane travelling with velocity of 200 km/h, with thrusts produced by engines shown. It has a mass of 250 Mg and a radius of gyration, kg = 13 m, about its center of gravity. Determine the angular...
-
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...
-
How do we choose a basis for allocating a cost to several departments?
-
Explain what each of the following statements means: a. Service departments do not work directly on products. b. Service department costs are manufacturing overhead costs. c. Overhead rates are not...
-
Briefly describe the general format, data, and calculations that would appear on an overhead distribution worksheet for a company with a number of production and service departments.
Study smarter with the SolutionInn App