// // ... // Run: cmd < data.txt // import java.text.DecimalFormat; import java.util.Scanner; class TwoStudentAvg { public static void main(String[] args) { DecimalFormat f1 = new DecimalFormat("0.0"); Scanner input = new Scanner(System.in); double score1, score2, score3, scoreavg; String studentName,dummy; score1 = input.nextDouble(); score2 = input.nextDouble(); score3 = input.nextDouble(); dummy = input.nextLine(); studentName = input.nextLine(); scoreavg = (score1 + score2 + score3)/3.; System.out.println( studentName + "'s average is: " + f1.format(scoreavg)); score1 = input.nextDouble(); score2 = input.nextDouble(); score3 = input.nextDouble(); dummy = input.nextLine(); studentName = input.nextLine(); scoreavg = (score1 + score2 + score3)/3.; System.out.println(studentName + "'s average is: " + f1.format(scoreavg)+"\n\n\n"); } }