required to store and analyze data about 6 car manufacturer's sales data in all the 12 months of a year. Demonstrate how you would store the data in a two dimensional matrix and do the following
1. Write a function to Find for a given car manufacturer, the month in which, maximum no. of cars are sold.
2 Write a function to Find the average number of cars sold for each car manufacturer 3. Write a function to Find the total number of cars sold for each car manufacturer 4. Write a function to find standard deviation for a given car manufacturer
package twodimensionalarray;
public class TwoDimensionalArray {
private int arr[][];
int maximum(){
int max = arr[0][0];
for(int i=0; i<6; i++){
for(int j=0; j<12; i++){
if(arr[i][j]>max){
max = arr[i][j];
}
}
}
return max;
}
void average_number(){
for(int i=0; i<6; i++){
int [] average = new int[6];
int sum = 0;
for(int j=0; j<12; i++){
sum += arr[i][j];
}
System.out.println(sum /6);
}
}
public static void main(String[] args) {
}
}
Comments
Leave a comment