can anybody help me? im new at this

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.
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.
if statements
Please say write clearly man, I have just no understood your question here?
Here's a start.
1
2
3
4
5
#include<iostream>
using namespace std;

int main(){}
     
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
Topic archived. No new replies allowed.