Posted by Adam Johnson on Tuesday, November 15, 2011 at 2:50am.
You are probably best to post the method so far. However, switch statements are shorthands for a group of if statements that all relate to the same quantity as:
if (x == 0) doSomething0();
else if (x == 1) doSomething1();
else if (x == 2) doSomething2();
else if (x == 3) doSomething3();
else if (x == 4) doSomething4();
else doSomethingElse();
So in your case you need to read the value from the array called numbers,
{
for (int counter=0, counter<numbers.length, n++)
{
x=numbers[counter];
// now use the if statements to count how many of each type there are in the array. For clarity you will need to declare three variables for number of negatives, positives and zeros. For example
int negatives=0;
int positives=0;
int zeros=0;
then use the switch statements to count each of the tree types.
Related Questions
Javascript - I need help these javascript exericses: Input: A text string, using...
JavaScript - I need help these javascript exericses: Input: A text string, using...
Javascript - How do take this following javascript and put in external ...
progra - how would i be able to write a function module for average from this ...
pseudocode programming - need help to write a sumsquare function module and then...
programming - JavaScript - /*Hello, I really hope someone can help me out with ...
A good programming forum??? - I'm working with VBScript and Javascript all ...
SQL for business help - I have no idea where to begin with this. A SQL statement...
JAVASCRIPT - Start button won't work for a scolling marquee. Below is the ...
Physics - What is the decimal equivalent of 3.14 × 10^7? is this the ...
For Further Reading