Write a void method named percentEven that accepts an array of integers as a parameter and prints the percentage of even numbers in the array as a real number and the positions that hold the even numbers. For example, if a variable named nums refers to an array of the elements (26, 52, 39, 71, 73}, the call of percentEven (nums) should print : Position [0] has an even number Position [1) has an even number The percent of even numbers is 40.04 If the array contains no even elements or no elements at all, print The percent of even numbers is 0.04.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

can you plz write it in java.util.scanner form

and can you plz make it so i can copy and past it.

Write a void method named percentEven that accepts an array of integers as a parameter and prints the percentage of even numbers in the array as a real number and the positions that hold the
even numbers.
For example, if a variable named nums refers to an array of the elements {26, 52, 39, 71, 73},
the call of percentEven (nums) should print :
Position [0] has an even number
Position [1] has an even number
The percent of even numbers is 40.0g
If the array contains no even elements or no elements at all, print The percent of even numbers is 0.08.
Transcribed Image Text:Write a void method named percentEven that accepts an array of integers as a parameter and prints the percentage of even numbers in the array as a real number and the positions that hold the even numbers. For example, if a variable named nums refers to an array of the elements {26, 52, 39, 71, 73}, the call of percentEven (nums) should print : Position [0] has an even number Position [1] has an even number The percent of even numbers is 40.0g If the array contains no even elements or no elements at all, print The percent of even numbers is 0.08.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random access
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage