Java Reference
In-Depth Information
else
{
outpFile.println("*** Grades are being held for "
+ "not paying the tuition. ***");
outpFile.printf("Amount Due: $%.2f%n",
sList[count].billingAmount(tuitionRate));
}
outpFile.println("-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"
+ "*-*-*-*-*-*-*-*-*-*-\r\n");
}
} //end printGradeReports
PROGRAM LISTING
//*************************************************************
// Author: D.S. Malik
//
// Program: Student Grade Report
// This program reads students' data from a file and outputs
// the grades. If a student has not paid the tuition, the
// grades are not shown, and an appropriate message is output.
// The output is stored in a file.
//*************************************************************
import java.io.*;
import java.util.*;
public class GradeReportProgram
{
public static void main(String[] args) throws
FileNotFoundException
{
int noOfStudents;
double tuitionRate;
1
0
Scanner inFile =
new Scanner( new FileReader("stData.txt"));
PrintWriter outFile =
new PrintWriter("sDataOut.out");
noOfStudents = inFile.nextInt(); //get the number
//of students
tuitionRate = inFile.nextDouble(); //get the tuition
//rate
Student[] studentList =
new Student[noOfStudents];
for ( int i = 0; i < studentList.length; i++)
studentList[i] = new Student();
getStudentData(inFile, studentList);
printGradeReports(outFile, studentList, tuitionRate);
Search WWH ::




Custom Search