Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello Please help, I am having alot of trouble with this code. We have to use recursion. rite a program that reads in a sequence

Hello Please help, I am having alot of trouble with this code. We have to use recursion.image text in transcribed

rite a program that reads in a sequence of integers from standard input until 0 is read, and stores them in an array. You may assume that there will not be more than 100 numbers Then compute the minimum number stored in the array, the count of odd numbers (includes both postive and negative odd integers), the number of -1 stored inside the array and compute the sum of numbers at even indexes (i.e. 0, 2, 4,...), using recursion. Thus you will create recursive methods findMin, countOdd, countNegativeOne and computeSumAtEvenlndexes in Assignment8 class and they will be called by a main method Specifically, the following four recursive methods must be implemented (These method should not contain any loop): //(1) It finds the minimum number in the partial array range from startlndex to endlndex public static int findMin((int/ / numbers, int startIndex, int endlndex) //(2) It counts the number of odd integers in the partial arrya range from startIndex to endlndex public static int countOdd(int/ / numbers, int startIndex, int endIndex) /3 )It counts the number of-1 inside an array with "count" numbers, index ranges from 0 to count-1 public static int countNegativeOne(int/ / numbers, int count) //(4) It computes the sum of numbers at index 0, 2, 4, ..., inside a partial array with "count'" numbers inside, index ranges from 0 to count-1 public static int computeSumAtEvenIndexes(int/ / numbers, int count) If these methods are implemented using a loop, points will be deducted even if your program passes test cases. DO NOT use any Static Variables either. The program should output the results of those calculations to standard output. Your program will continue to read in numbers until the number 0 is entered. At this point, the calculations will be outputted in the following format: The total number of odd integers is The total number of-1 is The sum of numbers at even indexes is rite a program that reads in a sequence of integers from standard input until 0 is read, and stores them in an array. You may assume that there will not be more than 100 numbers Then compute the minimum number stored in the array, the count of odd numbers (includes both postive and negative odd integers), the number of -1 stored inside the array and compute the sum of numbers at even indexes (i.e. 0, 2, 4,...), using recursion. Thus you will create recursive methods findMin, countOdd, countNegativeOne and computeSumAtEvenlndexes in Assignment8 class and they will be called by a main method Specifically, the following four recursive methods must be implemented (These method should not contain any loop): //(1) It finds the minimum number in the partial array range from startlndex to endlndex public static int findMin((int/ / numbers, int startIndex, int endlndex) //(2) It counts the number of odd integers in the partial arrya range from startIndex to endlndex public static int countOdd(int/ / numbers, int startIndex, int endIndex) /3 )It counts the number of-1 inside an array with "count" numbers, index ranges from 0 to count-1 public static int countNegativeOne(int/ / numbers, int count) //(4) It computes the sum of numbers at index 0, 2, 4, ..., inside a partial array with "count'" numbers inside, index ranges from 0 to count-1 public static int computeSumAtEvenIndexes(int/ / numbers, int count) If these methods are implemented using a loop, points will be deducted even if your program passes test cases. DO NOT use any Static Variables either. The program should output the results of those calculations to standard output. Your program will continue to read in numbers until the number 0 is entered. At this point, the calculations will be outputted in the following format: The total number of odd integers is The total number of-1 is The sum of numbers at even indexes is

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What is the difference between Needs and GAP Analyses?

Answered: 1 week ago

Question

What are ERP suites? Are HCMSs part of ERPs?

Answered: 1 week ago