Question
import java.util.*; public class StudentGrade { public static void main(String []args) { double test1, test2, test3, test4, test5; double average; String firstName; String lastName; Scanner
import java.util.*; public class StudentGrade { public static void main(String []args) { double test1, test2, test3, test4, test5; double average; String firstName; String lastName; Scanner inFile = new Scanner("test.txt"); PrintWriter outFile = new PrintWriter ("testavg.out"); firstName = inFile.next(); lastName = inFile.next(); outFile.println("Student name:" + firstName + "" + lastName); test1 = inFile.nextDouble(); test2 = inFile.nextDouble(); test3 = inFile.nextDouble(); test4 = inFile.nextDouble(); test5 = inFile.nextDouble(); outFile.printf("Test scores: %6.2f %6.2f %6.2f " + "%6.2f %6.2f %n", test1, test2, test3, test4, test5); average = (test1 + test2 +test3 + test4 + test5) /5.0; outFile.printf("Average test score: %6.2f %n", average ); inFile.close(); outFile.close(); } }
can you make this code run in java please
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started