can anybody help me? im new at this

Feb 8, 2015 at 11:07pm
Write an application that prompts the user for six integers and:

1) 1) Determines and prints the largest and the smallest integer in the group

2) 2) Keeps track of how many even and odd integers in the group and prints the total number of odd integers, and the total number of even integers, the sum of all odd integers, the total sum of even integers, the average of the even integers, and the average of the odd integers.
Feb 9, 2015 at 12:33am
So what is your question?

This is not a homework site. We're not going to do your homework for you.
Make an attempt to solve the problem and if you get stuck, post what you're stuck on.
Feb 9, 2015 at 12:50am
if statements
Feb 10, 2015 at 2:24am
Please say write clearly man, I have just no understood your question here?
Feb 10, 2015 at 4:58am
Here's a start.
1
2
3
4
5
#include<iostream>
using namespace std;

int main(){}
     
Feb 11, 2015 at 2:38pm
public class Array {

public static void main(String[] args) {
// TODO code application logic here
Scanner input = new Scanner(System.in);

int array[] = new int[6];

System.out.println("Enter 6 intergers:");

for (int i = 0 ; i < array.length; i++ ) {
int next = input.nextInt();
// sentineil that will stop loop when 999 is entered
if (next == 999)
break;
array[i] = next;

}


System.out.println("the 6 intergers are: ");
printArray(array);
System.out.println("\nThe highest integer: ");
System.out.println(getMaxValue(array));
System.out.println("Lowest integer: ");
System.out.println(getMinValue(array));



}


// getting the maximum value
public static int getMaxValue(int[] array){
int maxValue = array[0];
for(int i=1;i < array.length;i++){
if(array[i] > maxValue){
maxValue = array[i];

}
}
return maxValue;
}

// getting the miniumum value
public static int getMinValue(int[] array){
int minValue = array[0];
for(int i=1;i<array.length;i++){
if(array[i] < minValue){
minValue = array[i];
}
}
return minValue;
}

//this method prints the elements in an array......
//if this case is true, then that's enough to prove to you that the user input has //been stored in an array!!!!!!!
public static void printArray(int arr[]){

int n = arr.length;

for (int i = 0; i < n; i++) {
System.out.print(arr[i] + " ");
}
}

}

-that's all I have. now I need to know how I can get the program to tell me which ones are odd and which ones are even.
Last edited on Feb 11, 2015 at 2:40pm
Topic archived. No new replies allowed.