Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

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.

 

Java, Programming

  • Category:- Java
  • Reference No.:- M92408026
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Java

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Assessment instructionsin this assessment you will design

Assessment Instructions In this assessment, you will design and code a simple Java application that defines a class, instantiate the class into a number of objects, and prints out the attributes of these objects in a spe ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assignment - method in our madnessthe emphasis for this

Assignment - "Method in our Madness" The emphasis for this assignment is methods with parameters. In preparation for this assignment, create a folder called Assign_3 for the DrJava projects for the assignment. A Cityscap ...

Project requirementsfor the problem described in the next

Project requirements For the problem described in the next section, you must do the following: 1. include your student ID at the end of all filenames for all java code files. Three classes have been identified in section ...

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Simple order processing systemquestion given the classes

Simple Order Processing System Question: Given the classes Ship (with getter and setter), Speedboat, and SpeedboatTest. Answer the following questions: Refine the whole application (all classes) and create Abstract class ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As