Compute the sum of odd numbers

Assignment Help JAVA Programming
Reference no: EM131599313

You are not allowed to use the Scanner class in this assignment and any assignment after this one. You will need to use InputStreamReader and BufferedReader (they are in java.io package) to process input and also take care of IOException.

Program Description
Assignment #9 will be the construction of a program that reads in a sequence of integers from standard input until 0 is read, and store them in an array (including 0). This is done using iteration (choose one of for, while, or do while loop). You may assume that there will not be more than 100 numbers.
Then compute the minimum number, compute the sum of odd numbers, count negative numbers, and compute the sum of numbers in the array are less than the last number entered right before 0. (You can assume that a user will enter at least one non-zero number before 0 is entered.) using recursion. Thus you will create recursive methodsfindMin, computeSumOfOdd, countNagative, and sumLessThanLast in Assignment9 class and they will be called by a main method.
Specifically, the following recursive methods must be implemented (These methods should not contain any loop):

public static int findMin(int[] numbers, int startIndex, int endIndex)
public static int computeSumOfOdd(int[] numbers, int startIndex, int endIndex)
public static int countNegative(int[] numbers, int startIndex, int endIndex)
public static int sumLessThanLast(int[] numbers, int startIndex, int endIndex, int lastNumber)
If these methods are implemented using a Loop or any Static Variable, points will be deducted (from the test cases) even if your program passes test cases. DO NOT use any Static Variables.
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 minimum number is 0
The sum of odd numbers is 0
The count of negative numbers is 0
The sum of numbers that are less than the last is 0
Note that the result values will be different depending on test cases (not always 0).
Do not output a prompt to query for the numbers. The number 0 is included in the sequence of numbers and should be included in all of your calculations.

 

Reference no: EM131599313

Questions Cloud

What social work values are embraced : How do theoretical concepts translate into or guide specific practice goals and practice skills?What social work values are embraced?
Explain about imaginative approach to research conversation : Write about a three-page explanation of how two different sources look at your topic differently (you may make it longer, if you wish).
Experimental value for the change in oxidation : If I found an experimental value for the change in oxidation state for ClO3- to be 5, what would the balanced oxidation half reaction, balanced reduction.
Explain the key steps that might require a contingency plan : Explain the key steps that might require a contingency plan. Analyze how creativity and critical thinking relate to contingency planning.
Compute the sum of odd numbers : Compute the minimum number, compute the sum of odd numbers, count negative numbers, and compute the sum of numbers in the array are less than the last number
Discuss the critical thinking skills in the given process : The paper will not be just a report presenting information, but will be a paper that carefully examines and presents your own historical interpretation.
What measures did you use to track success of your project : What measures did you use to track the success of your project? In what way do you feel that your project has contributed to your company?
How would this research be valuable : How would this research be valuable? What possible benefits would there be for juvenile justice?
Create an array for gross_pay : Following are three arrays, each containing 20 data. Array emp_hours contain the number of hours worked by 20 employees

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd