Hi im writing a program using arrays but im not sure what to do. I think i have the first three methods done correctly but i cant figure out how to do the rest. Im also supposed to write an application file but im not sure how to with arrays. The question is below and so is the code that i have written so far.


The array will be an instance variable in a class definition file. This class definition file will also contain the following methods (to perform the tasks outlined in Programming Project):
• a method to output the total number of A’s, B’s, ..., F’s, the total number of scores and the percentage of the total for each letter grade
• a method to find the range of the scores, that is the lowest and highest scores
• a method to find the average score
• a method to write out the data stored in the array
• one constructor method should pass to the class definition file, the array created in the application file that contains the data
• also create a setData method that can receive the array containing data from the application

import java.util.Scanner;

public class Grades
{


	private int minScore = 0;
	private int maxScore = 0;
	private int averageScore = 0;
	private int aCount = 0;
	private int bCount = 0;
	private int cCount = 0;
	private int dCount = 0;
	private int eCount = 0;
	private int fCount = 0;
	private String grade = " ";
	private boolean elementsMatch = true;
	
    
    public void letterGradeStats(int [] array)
    {	
		for (int i = 0; i < array.length - 1; i++)
    	{
    		int n1 = 0;
    		n1 = array[i];
    		getLetterGrade(n1); 
    	}	
    	System.out.println("'A' " + " = " + "	" + aCount);
    	System.out.println("'B' " + " = " + "	" + bCount);
    	System.out.println("'C' " + " = " + "	" + cCount);
    	System.out.println("'D' " + " = " + "	" + dCount);
    	System.out.println("'E' " + " = " + "	" + eCount);
    	System.out.println("'F' " + " = " + "	" + fCount);
    	System.out.println();

    	
    	System.out.println("Total Number of Scores: " + " = " + 	+ array.length);
    	System.out.println();
    	
 
    	double a = (int) aCount * 100;
    	double b = (int) bCount * 100;
    	double c = (int) cCount * 100;
    	double d = (int) dCount * 100;
    	double e = (int) eCount * 100;
    	double f = (int) fCount * 100;
    	System.out.println("'A'" + " = " + "	" + a / array.length + "%");
    	System.out.println("'B'" + " = " + "	" + b / array.length + "%");
    	System.out.println("'C'" + " = " + "	" + c / array.length + "%");
    	System.out.println("'D'" + " = " + "	" + d / array.length + "%");
    	System.out.println("'E'" + " = " + "	" + e / array.length + "%");
    	System.out.println("'F'" + " = " + "	" + f / array.length + "%");
    	System.out.println();
    	
    }
    

    private String getLetterGrade(int n1)
    {		
    		if ((n1 >= 90.0) && (n1 <= 100.0))
    		{	
    			grade = "A";
    		    aCount++;
    		}
    		else if ((n1 >= 80.0) && (n1 < 90.0))
    		{	
    			grade = "B";
    		    bCount++;
    		}
    		else if ((n1 >= 70.0) && (n1 < 80.0))
    		{	
    			grade = "C";
    		    cCount++;
    		}
    		else if ((n1 >= 60.0 )&& (n1 < 70.0))
    		{	
    			grade = "D";
    		    dCount++;
    		}
    		else if ((n1 >= 50.0) && (n1 < 60.0))
    		{	
    			grade = "E";
    		    eCount++;
    		}
    		else if ((n1 >= 0.0) && (n1 < 50.0))
    		{	
    			grade = "F";
    		    fCount++;
    		}
    		return grade;
    }
    

    public void scoreRange(int [] array)
    {
    	minScore = 99999;
    	maxScore = -1;   
    
    	for (int i=0; i < array.length - 1; i++)
    	{
    		if (minScore > array[i+1])
    		    minScore = array[i+1];
    	}

    	for (int i=0; i < array.length - 1; i++)
    	{
    		if (maxScore < array[i+1])
    		    maxScore = array[i+1];
    	}
    	System.out.println("Lowest Score = " + "	" + minScore + "		" + "Highest Score = " + "	" + maxScore);
    	System.out.println();

    }

	public void scoreAverage(int [] array)
    {		
		int sum = 0;
		for (int i = 0; i < array.length - 1; i++)
		{
			sum = sum + array[i];
		}
		averageScore = sum / array.length;
		System.out.println("Average Score = " + "	" + averageScore);
		System.out.println();
    }
}

Can anyone help I don't know how to write the application file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.