Question: This is what I have so far. I'm not sure how to get the program to display the total amount of odd numbers in the

 This is what I have so far. I'm not sure howto get the program to display the total amount of odd numbers

This is what I have so far. I'm not sure how to get the program to display the total amount of odd numbers in the file/ how to get the second method to recognize "n". Thanks for your help!

/* This program helps the user to determine whether the number is a odd number. In order to do so, you need to (1) create a class called "homework5_1" (2) read the number from a file called "numbers.txt" one by one in the main method (3) determine whether the number is a odd number in a seperate method called "isodd". The method returns "true" if it is a odd number, and "false" otherwise. Here is the logic to determine odd number: In java, \% means modulus, which takes the remainder from division. For example 5%3=2. Odd number means a number modulus 2==1 (number\%2 ==1 or number\%2 !=0 ) (4) determine the number of odd number in this file Here are the examples: Example 1: numbers in the input file, "numbers.txt": 1, 2, 3, 4, 5 output: 3 Example 2: numbers in the input file, "numbers.txt": 1,3,5,7,9,11,13,15,17,19 output: 10

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!