I am supposed to be writing this program and this is what I have so far...
import java.io.*;
import java.util.*;
public class assignment
{
public static void main(String[] args) throws FileNotFoundException
{
double quiz1, quiz2, quiz3, quiz4;
double average;
String firstName;
String lastName;
Scanner inFile =
new Scanner(system.n);
PrintWriter outFile = new
PrintWriter("testavg.out");
firstName = inFile.next();
lastName = inFile.next();
outFile.println("Student Name: "
+ firstName + " " + lastName);
quiz1 = inFile.nextDouble();
quiz2 = inFile.nextDouble();
quiz3 = inFile.nextDouble();
quiz4 = inFile.nextDouble();
average = (quiz1 + quiz2 + quiz3 + quiz4) / 4.0;
outFile.printf("Average quiz score: %5.2f %n",
average);
if (average>=90)System.out.println("A");
else if (average>=80)System.out.print("B");
else if (average>=70)System.out.print("C");
else if (average>=60)System.out.print("D");
else if (average<=50)System.out.print("F");
inFile.close();
outFile.close();
}
}
WHAT I NEED TO DO IS WRITE IT SO THAT THE USER INPUTS A NUMBER OF QUIZES AND IT FINDS THE AVERAGE. AND I CAN NOT FIX THE ERRORS. IE. THE SCANNER ERROR
PLEASE HELP ME!!!!