Hello everyone!! I am in my second year of college and am majoring in computer science, however, my computer programming beginner class is the first programming I have ever done in my life and I would love if anybody could comment on this homework assignment I have! I've done most of it but there are still pieces missing. Here are the instructions:
Write a program: MidtermStat.java, to output (on screen) the average, lowest, and highest grades in the midterm exam (if there is multiple highest and lowest, just output one of them). The midterm grades are previously stored in a text file named "midterm_grade.txt". You may assume there are exactly 30 grades in the file.
import java.io.*; import java.util.*; public class MidtermStat { public static void main(String[] ags) throws IOexception { Scanner in = new Scanner(new FileReader("midterm_grade.txt")); int number; int lowest = 36.0; int highest = 100.0; double average; System.out.println("Numbers on file midterm_grade.txt: "); while (in.hasNextInt()) { number = in.nextInt(); System.out.println("The lowest grade is: "); System.out.print("The highest grade is: "); } System.out.println(); in.close(); } }
//I'm supposed to be using count-controlled loop or event controlled loop in this
//along with if-else statements
//the file called "midterm_grade.txt" is a seperate file composed of approximately 30 grades
//the lowest grade is 36.0 and the highest is obviously 100.0