Answer to Question #248068 in Java | JSP | JSF for Memo

Question #248068
Write a Java program to display the three top sales made by employees of an organization. The
rows and columns represent the sales made by each employee identified by their employee
number.
SALES 1 SALES 2 SALES 3
101111 R 3 000 R 2 000 R 3 500
101122 R 2 500 R 5 500 R 3 500
101133 R 1 100 R 2 000 R 4 500
101144 R 1 700 R 2 700 R 2 500
101155 R 5 000 R 2 900 R 5 900
Using a Two Dimensional array produce the employee sales report, and the total sales made by
each employee.
1
Expert's answer
2021-10-07T14:00:22-0400


package employeesalesreport;


public class EmployeeSalesReport {


    
    public static void main(String[] args) {
        int [][] arrData = new int[5][3];
        int [] employee_sales = {3000,2000,3500,2500,5500,3500,1100,2000,4500,1700,2700,2500,5000,2900,5900};
        int k =0;
        for(int i=0; i<5; i++){
            for(int j=0; j<3;j++){
                arrData[i][j] = employee_sales[k++];
            }
        }
        
      
        System.out.println("*******************************************************************");
        System.out.println("\t\t\tEMPLOYEE SALES REPORT");
        System.out.println("*******************************************************************");
        System.out.println("EMPLOYEE\t\tSALES 1\t\tSALES 2\t\tSALES 3");
        int [] employee = {101111, 101122, 101133,101144,101155};
        int [] total = new int[5];
        for(int i=0; i<5; i++){
            int sum = 0;
          System.out.printf("%d-->\t\t",employee[i] );  
          for(int j=0; j<3; j++){
             System.out.printf("R %d\t\t",arrData[i][j]); 
             sum += arrData[i][j];
          }
          total[i] = sum;
          System.out.println(" ");
        }
         System.out.println("*******************************************************************");
        System.out.println("\t\t\tEMPLOYEE TOTAL SALES");
        System.out.println("*******************************************************************");
        
        for(int i=0; i<5; i++){
          System.out.printf("%d-->\t\t R %d\n",employee[i],total[i]);   
        }
        
    }
    
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS