//Name:
import java.util.*;
import static java.lang.System.*;
public class Methods {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
int grade1 = 0;
int grade2 = 0;
int grade3 = 0;
int sum = 0;
double average = 0.0;
System.out.println(" enter grade one * ");
grade1 = reader.nextInt();
out.println(" *enter grade two * ");
grade2 = reader.nextInt();
out.println(" *enter grade three * ");
grade3 = reader.nextInt();
sum = findSum(grade1, grade2, grade3);
average = findAverage(sum);
System.out.println(" Your average = " + average);
System.out.println();
comment(average);
higher(grade1, grade2, grade3);
} // end of main
//******************************************************************** 1
public static int findSum(int g1, int g2, int g3) {
return g1 + g2 + g3;
}
//********************************************************************
public static double findAverage(int sum) {
return sum / 3.0;
}
//**************************************************************
// Prints a comment based on the average
public static void comment(double myAvg) {
if (myAvg >= 90) {
System.out.println("A!");
} else if (myAvg >= 80) {
System.out.println("B!");
} else if (myAvg >= 70) {
System.out.println("C!");
} else if (myAvg >= 60) {
System.out.println("D!");
} else {
System.out.println("F!");
}
}
//**************************************************************
// Return the largest of the three values
public static int higher(int g1, int g2, int g3) {
int array[] = {g1, g2, g3};
int highest = 0;
int lowest = 0;
int largest = Integer.MIN_VALUE;
int smallest = Integer.MAX_VALUE;
System.out.println("Array.length: " + array.length);
for (int i = 0; i < array.length; i++)
{
if (i > largest)
{
i = highest;
System.out.println(i);
}
if (i < smallest)
{
i = lowest;
System.out.println(i);
}
}
return highest;
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: