ITCS114 Assignment 2 - Arrays Part (1): Write a Java program to do the following: 1) Ask the user to enter a positive integer (n). Ask the user to renter n in case a negative value is entered. 2) Create an array named list of size (n) integers 3) Ask the user to enter (n) integers and store them in the array list. 4) Ask the user to enter an integer x. 5) Print all even numbers below x Example: Enter an integer n: -5 Invalid size, Reenter a positive integer: 8 Enter 8 values: 11 2 3 -4 -15 6 9 10 Enter integer x: 7 Even numbers below 7: 2 -4 6

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 16PE
icon
Related questions
Question

Java program

ITCS114 Assignment 2 - Arrays
Part (1): Write a Java program to do the following:
1) Ask the user to enter a positive integer (n). Ask the user to renter n
in case a negative value is entered.
2) Create an array named list of size (n) integers
3) Ask the user to enter (n) integers and store them in the array list.
4) Ask the user to enter an integer x.
5) Print all even numbers below X
Example:
Enter an integer n: -5
Invalid size, Reenter a positive integer: 8
Enter 8 values: 11 2 3 -4 -15 6 9 10
Enter integer x: 7
Even numbers below 7: 2 -4 6
Transcribed Image Text:ITCS114 Assignment 2 - Arrays Part (1): Write a Java program to do the following: 1) Ask the user to enter a positive integer (n). Ask the user to renter n in case a negative value is entered. 2) Create an array named list of size (n) integers 3) Ask the user to enter (n) integers and store them in the array list. 4) Ask the user to enter an integer x. 5) Print all even numbers below X Example: Enter an integer n: -5 Invalid size, Reenter a positive integer: 8 Enter 8 values: 11 2 3 -4 -15 6 9 10 Enter integer x: 7 Even numbers below 7: 2 -4 6
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage