how to find [count the number of integers whose value is less than the average value of the integers]
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners

Construct an algorithm that will prompt for and receive 10 Construct an algorithm that will prompt for, receive and total a collection of payroll amounts entered at the terminal until a sentinel amount of 999 is entered. After the sentinel has been entered, display the total payroll amount to the screen integers from an operator at a terminal, and count the number of integers whose value is less than the average value of the integers. Your program is to display the average integer value and the count of integers less than the average.


View Answers

January 22, 2011 at 1:11 PM

Hi Friend,

Try this:

import java.util.*;
class PayrollAmounts
    public static void main(String[] args) 
        int sum=0;
        int amount=0;
        int count=0;
        int no=0;
        String total="";
        ArrayList list=new ArrayList();
        Scanner input=new Scanner(System.in);
            System.out.print("Enter amount: ");
            amount= input.nextInt(); 
            total+=Integer.toString(amount)+" ";
        while (amount != 999);
        System.out.println("Collection of all Payroll Amounts:");
        String arr[]=total.split(" ");      
        int array[]=new int[arr.length-1];
        for(int i=0;i<arr.length-1;i++){
        for(int i=0;i<array.length;i++){
        double average=sum/count;
        for(int i=0;i<array.length;i++){
        System.out.println("Sum of all payroll amounts: "+sum);
        System.out.println("Average of all payroll amounts: "+average);
        System.out.println("No of payroll amounts less than average: "+no);


Related Tutorials/Questions & Answers: