Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Description Take a group of numbers all on the same line and determine how many are odd and how many are even. An even

image text in transcribedimage text in transcribedimage text in transcribed

Lab Description Take a group of numbers all on the same line and determine how many are odd and how many are even. An even number is evenly divisible by two and an odd number is not evenly divisible by two. You can test divisibility using the mod(%) operator is evenly di Sample Data: 910 5 20 11 22 33 44 55 66 77 3 5 31575 43 278 9 99 6 2 468 2 4 6 1 3 57913 5 Files Needed oddEvenCounterRunner.ava Sample Output: 9 10 5 20 even count- 2 odd count-2 11 22 33 44 55 66 7 even count-3 odd count- 3 5 31575 43 278 9 99 6 even count4 odd count-12 2 468 2 4 6 even count-7 odd count-0 1 3 57913 5 even count- 0 odd count-8 import java.util.Scanner; import static java.lang.System.; public class OddEvenCounter private String line; public OddEvenCounter () public OddEvenCounter (String s) public void setLine(String s) public int getEvenCount) int count- 0 return count; public int getoddCount) int count- 0 return count; public String tostring() return import java.util.Scanner; import static java.lang.System.* public class OddEvenCounterRunner public static void main(String args[ ])

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

Students also viewed these Databases questions