1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
ozzi
3 years ago
5

Write a program that takes 10 integers as input. The program places the even integers into an array called evenList, the odd int

egers into an array called oddList, and the negative integers into an array called negativeList. The program displays the contents of the three arrays after all the integers have been entered
Computers and Technology
1 answer:
Elena L [17]3 years ago
8 0

import java.util.Scanner;

public class Main{

public static void main(String [] args){

Scanner integers = new Scanner(System.in);

int a, countNegative = 0, countOdd = 0, countEven = 0;

int []arr = new int[10];

System.out.println("Enter 10 integers");

for(a = 0; a < arr.length; a++){

arr[a] = integers.nextInt();

if(arr[a] < 0)

countNegative++;

if(arr[a] % 2 == 0)

countEven++;

if(arr[a] % 2 == 1)

countOdd++;

}

int[] oddList = new int[countOdd];

int[] evenList = new int[countEven];

int[] negativeList = new int[countNegative];

int o, e, n, o1, e1, n1, i;

for(o = 0; o < arr.length; o++){

if(arr[o] % 2 == 1){

for(o1 = 0; o1 < countOdd-1; o1++){

oddList[o1] = arr[o];

}

}

else if(arr[0] % 2 == 0){

for(e1 = 0; e1 < countEven-1; e1++){

evenList[e1] = arr[o];

}

}

else{

for(n1 = 0; n1 < countNegative-1; n1++){

negativeList[n1] = arr[o];

}

}

}

for(i = 0; i < countOdd-1; i++){

System.out.println(oddList[i]);

}

for(i = 0; i < countNegative-1; i++){

System.out.println(negativeList[i]);

}

for(i = 0; i < countEven-1; i++){

System.out.println(evenList[i]);

}

}

}

You might be interested in
National ISPs usually offer fewer services and have a smaller technical support staff than regional ISPs.
choli [55]

Answer:

um not sure

Explanation:

5 0
3 years ago
Mr. Yang is a doctor who regards video games as an effective means of staying fit. What type of game would he recommend to his p
morpeh [17]

Answer:

D. An exergame

Explanation:

It is because the exercise game is the suitable game to staying fit. For example wii video game able to give the similar experience to outdoor activities such as playing tennis, kick boxing etc.

8 0
3 years ago
Read 2 more answers
What is the best wi-fi name you have ever seen?
elena-s [515]

Answer:

bill wi the science fi

Explanation:

8 0
3 years ago
Consider the two computers A and B with the clock cycle times 100 ps and 150 ps respectively for some program. The number of cyc
Kipish [7]

Answer:

Option d) B is 1.33 times faster than A

Given:

Clock time, t_{A} = 100 ps

t_{A} = 150 ps

No. of cycles per instructions,  n_{A} = 2.0

n_{B} = 1.0

Solution:

Let I be the no. of instructions for the program.

CPU clock cycle, f_{A} = 2.0 I

CPU clock cycle, f_{B} = 1.0 I

Now,

CPU time for each can be calculated as:

CPU time, T = CPU clock cycle\times clock time

T_{A} = f_{A}\times t_{A} = 2.0 I\times 100 = 200 I ps

T_{B} = f_{B}\times t_{B} = 1.0 I\times 100 = 150 I ps

Thus B is faster than A

Now,

\frac{Performance of A}{Performance of B} = \frac{T_{A}}{T_{B}}

\frac{Performance of A}{Performance of B} = \frac{200}{150}

Performance of B is 1.33 times that of A

7 0
3 years ago
Read 2 more answers
Develop a script to demonstrate an understanding of the overload (overwrite) methods of using Python operators. This lesson will
MrRa [10]

hsjshekejeoehejeoejebenwkwuwbnwlwjdvrbrnfnfjkddjddmdmdndnfndmdkdjdjdjdjjdjdjdjdkdkdkdkdfkkdjdjdjdyremssjyehsmmamaajbshsjsbdbsksidhdbdbddddddddododododkdkdkdjdjdhddhhdvxbxbbxbxbxjdiegebeodhe

8 0
3 years ago
Other questions:
  • What effects will the different types of lighting produce on mountains?
    15·1 answer
  • Peter has recently bought a media player and a digital camera. He wants to buy a memory card for these devices. Which memory dev
    12·2 answers
  • PLZ HELP ME! What is a false statement about online time?
    9·1 answer
  • In Windows Vista, the Run command can be found in which application?
    6·1 answer
  • Can you make copies of classified documents provided you alert others?
    6·1 answer
  • Fourlotts Corp. provide integrated services that include storing manufactured goods, packaging, and delivering it to the dealers
    13·1 answer
  • Assume that a is an array of two or more integers, and that b and c are integers.
    13·1 answer
  • Where are the results from the Advanced Find feature displayed?
    6·1 answer
  • Difrent between computer and computer system​
    9·1 answer
  • Mha lovers why do other anime lovers report mha lovers for not liking there anime?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!