// ************************************************************************// Warning.java//// Reads student data from a text file and writes data to another text file.// ************************************************************************import java.util.Scanner;import java.io.*;public class Warning{// -------------------------------------------------------------------// Reads student data (name, semester hours, quality points) from a// text file, computes the GPA, then writes data to another file// if the student is placed on academic warning.// -------------------------------------------------------------------public static void main (String[] args){int creditHrs; // number of semester hours earneddouble qualityPts; // number of quality points earneddouble gpa; // grade point (quality point) averageString line, name, inputName = "students.dat";String outputName = "warning.dat";Scanner scanLine;try{// Set up scanner to input fileScanner inFile = new Scanner(new File(inputName));// Set up the output file streamPrintWriter outFile = new PrintWriter(new FileWriter(outputName));
You've reached the end of your free preview.
Want to read both pages?
- Fall '09
- Academic term