Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a Java program that does this: You are in a tutor center that counts the

ID: 3622013 • Letter: I

Question

I need a Java program that does this:
You are in a tutor center that counts the number of students. The program needs to read the number of tutors from the command line.
The program shall read the data as integers from a file named “tutors.txt” into a two-dimensional array (I have the file)
The program needs to print the following named tutorData[numOfTutors][3]. (Please note that in the example above, the numbers in bold are in the file and then stored in the array and not the headings of rows/columns). The file has numOfTutors total lines, each line contains 3 integers (number of students per day for a tutor), separated by spaces.
output (underlined
“Total number of students using the center: = values computed from program):
M: value, Tu: value, W: value. Total: value
Tutor1: . (sum of students for each day, sum of all day sums)
value, Tutor2: value, …. Total: value
Max total students per day: . (sum of students for each tutor, sum of all tutor sums)
value
Max students per tutor: . (max of all day sums)
value
Minimum number of students in all slots: . (max of all tutor sums)
value
The program shall use int[] .” (min of all elements of array)
arrays
The program shall use the following to store results for above computations: sumPerDay[3], sumPerTutor[numOfTutors].
methods
• readData() to read the data from the file in (2). The method takes an 2-D int[][] array as parameter (the tutorData) and returns nothing. :
• max1dArray() to calculate the maximum value of a 1-D array, e.g. sumPerDay[]. This method shall take an int[] array as parameter, and return an int as the result.
• min1dArray() to calculate the min value of a 1-D array, e.g. a row of tutorData. This method shall take an int[] array as parameter, and return an int as the result.
Note: please note that the displayed max is of a sum, either per row (tutor) or per column (day), while the displayed min is calculated for all the individual
array elements.

Explanation / Answer

please rate - thanks

import java.io.*;
import java.util.*;

public class commandin
{public static int numOfTutors;
public static void main(String[] args)throws FileNotFoundException
{int i,j,total=0,max,min,totalStudents=0;
numOfTutors=Integer.parseInt(args[0]);

int [][]tutorData=new int[numOfTutors][3];
int[] sumPerDay=new int[3];
int[] sumPerTutor=new int[numOfTutors];
for(i=0;i<3;i++)
    sumPerTutor[i]=0;
for(i=0;i<numOfTutors;i++)
    sumPerDay[i]=0;
readData(tutorData);   
for(i=0;i<numOfTutors;i++)   
   for(j=0;j<3;j++)    
       sumPerTutor[i]+=tutorData[i][j];
for(i=0;i<3;i++)        
    for(j=0;j<numOfTutors;j++)
       sumPerDay[i]+=tutorData[j][i];
for(i=0;i<3;i++)
    totalStudents+=sumPerDay[i];
System.out.println(" Usage");
   System.out.println("tutor Mon Tue Wed Total");
for(i=0;i<numOfTutors;i++)
   {System.out.print((i+1));
    for(j=0;j<3;j++)
         System.out.print(" "+tutorData[i][j]);
    System.out.println(" "+sumPerTutor[i]);
    }   
System.out.print("Daily Total ");
for(i=0;i<3;i++)
   System.out.print(sumPerDay[i]+" ");
System.out.println();
   
System.out.println(" Total number of students using the center: "+totalStudents);

System.out.println("Max of days "+max1dArray(sumPerDay,3)+"-min of days "+min1dArray(sumPerDay,3));

System.out.println("max of tutors "+max1dArray(sumPerTutor,numOfTutors)+"-min of tutors "+min1dArray(sumPerTutor,numOfTutors));
      
   


}
public static void readData(int tutorData[][])throws FileNotFoundException

   {int i,j;
    Scanner input=new Scanner(new File("tutors.txt"));
    for(i=0;i<numOfTutors;i++)
     for(j=0;j<3;j++)
           tutorData[i][j]=input.nextInt();

}
public static int max1dArray(int a[],int n)
{int i,m=a[0];
for(i=1;i<n;i++)   
    if(a[i]>m)
        m=a[i];
return m;
}
public static int min1dArray(int a[],int n)
{int i,m=a[0];
for(i=1;i<n;i++)   
    if(a[i]<m)
        m=a[i];
return m;
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote