Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

add the mising code: Declare a Boolean variable named allNegative. Then, read integer inCount from input representing the number of integers to be read next.

add the mising code: Declare a Boolean variable named allNegative. Then, read integer inCount from input representing the number of integers to be read next. Use a loop to read the remaining integers from input. If all inCount integers are negative, assign allNegative with true. Otherwise, assign allNegative with false.
Code at the end of main() outputs "All match" if allNegative is true or "Not all match" if allNegative is false.
Ex: If the input is:
3
-90-75-25
then the output is:
All match import java.util.Scanner;
public class NegativeIntegers {
public static void main(String [] args){
Scanner scnr = new Scanner(System.in);
int inCount;
/* Additional variable declarations go here */
/* Your code goes here */
if (allNegative){
System.out.println("All match");
}
else {
System.out.println("Not all match");
}
}
}

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 3 Lnai 6323

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

3642159389, 978-3642159381

More Books

Students also viewed these Databases questions

Question

=+2. How reliable is this existing information?

Answered: 1 week ago