This is the criteria i am required to get my program to do. I have looked on google for help but I can't find any.
Enhance / modify the program you created in the previous assignment. Create a class ScanArray. This class should have two methods FindMax and FindMin. Class ScanArray should have a constructor.
Program processing should parallel these steps :
main prompts the user for the grades of MidTerm1 and stores the data in an array.
main prompts the user for the grades of MidTerm2 and stores the data in an array.
main prompts the user for the grades of FinalExam and stores the data in an array.
main adds the grades of the 3 tests and stores the totals in an array.
main calls the constructor of ScanArray passing the array of totals to the constructor.
main calls the FindMin method; not passing anything to it.
FindMin will return to main the minimum value found in the total of the grades.
main calls the FindMax method; not passing anything to it.
FindMax will return to main the maximum value found in the total of the grades.
main informs the Business User of the minimum grade and maximum grade.
This is my code from the project which i need to modify. As you can tell I am not very good at java. I can do this in C++ but don't understand why i can't do this in java. Any help and or code samples are much appreciated.
package assign6_sb;
import java.util.Scanner;
public class Assign6_SB {
public static void main(String[] args) {
//arrays
Scanner SC = new Scanner(System.in);
int[] midterm1 = new int[10];
int[] midterm2 = new int[10];
int[] fExam = new int[10];
int[] total = new int[10];
//collections
int m1Collect;
int m2Collect;
int fexCollect;
//counter for student
int counter1 = 1;
int counter2 = 1;
int counter3 = 1;
//fill midterm1
for(int index = 0; index < midterm1.length; index++)
{
System.out.println("Enter the grades for midterm 1: Student: "+counter1);
m1Collect = SC.nextInt();
counter1++;
midterm1[index] = m1Collect;
}
//fill midterm2
for(int index = 0; index < midterm2.length; index++)
{
System.out.println("Enter the grades for midterm 2: Student: "+counter2);
m2Collect = SC.nextInt();
counter2++;
midterm2[index]=m2Collect;
}
//fill fExam
for(int index = 0; index < fExam.length; index++)
{
System.out.println("Enter the grades for the final exam: Student: "+counter3);
fexCollect = SC.nextInt();
counter3++;
fExam[index]=fexCollect;
}
//fill the total with the summed values
for (int index = 0; index < total.length; index++)
{
total[index] = (midterm1[index] + midterm2[index] + fExam[index]);
}
//fill the min and max with the first index
int max = total[0];
int min = total[0];
//find the min and max
for (int index = 0; index < total.length; index++)
{
if(total[index] > max)
max = total[index];
if(total[index] < min)
min = total[index];
}
System.out.println("The maximum grade is " + max);
System.out.println("The minimum grade is " + min);
}
}