Java:
/* Get three exam grades from the user and compute the average of the grades.
Output the average of the three exams. Together with the average,
also include a smiley face in the output if the average is greater than or equal to 60, otherwise output :-(. */
import java.util.Scanner;
public class average {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the first number: ");
double num1 = scan.nextDouble();
System.out.print("Enter the second number: ");
double num2 = scan.nextDouble();
System.out.print("Enter the third number: ");
double num3 = scan.nextDouble();
scan.close();
System.out.print("The average of entered numbers is:" + avr(num1, num2, num3));
if (avr = < 60) {
System.out.println(":-)");
} else {
System.out.println(":-(");
}
}
public static double avr(double a, double b, double c) {
return (a + b + c) / 3;
}
}