Question
this is a practicing question and i need help Score Last Name First Name The report output should appear as: File Input/Output techniques. Generate a
this is a practicing question and i need help
Score
Last Name
First Name
The report output should appear as:
File Input/Output techniques.
Generate a properly formatted report containing a report header with date. The detail lines must include the student name, letter grade, and score.The summary should include the total number of exams, a breakdown of grade distribution, and the average exam score.The output report file name should be report.txt.
3.When assigning letter grades, use the following scale: 90 to 100 - A, 80 to 89 - B, 70 to 79 - C, 60 to 69 - D, below 60 - F.
import java.io.*;
import java.util.*;
public class FileIOExample
{
Scanner inFile;
PrintWriter outFile;
private String title;
private int quantity;
FileIOExample()
{
try
{
inFile = new Scanner(new File("critterinventory.txt"));
outFile = new PrintWriter(new FileWriter("critterreport.txt"));
write_report_heading();
read_data();
inFile.close();
outFile.close();
}
catch(Exception e)
{
if(e instanceof FileNotFoundException)
{
System.out.println("FILENAME NOT FOUND");
System.exit(1);
}
}
}
public void read_data()throws IOException
{
inFile.useDelimiter(",|\ ");
while (inFile.hasNext())
{
quantity = inFile.nextInt();
title = inFile.next();
write_a_record();
} //end while loop
}
public void write_a_record()throws IOException
{
//outFile.print("");
outFile.print(quantity + "\t");
outFile.println(title);
}
public void write_report_heading()throws IOException
{
Calendar today = Calendar.getInstance();
outFile.print("\t\t\tCritters in Store ");
outFile.println("\t\t\t\t" + today.getTime());
outFile.println();
outFile.print("Quantity \t Animal ");
outFile.println();
}
public static void main(String[] args)
{
FileIOExample z = new FileIOExample();
}
}
85,Brown,Sandy
95,Grabau,James
84,Rodriguez,Kay
75,McVey,Jane
45,Eno,Brian
87,Lanois,Daniel
67,Thomas,Paul
55,Jocabs,Rob
99,Mangon,Colton
86,Bob,Spounge
67,Star,Patrick
99,Hall,Bobbie
76,Chan,Danny
92,Brown,Crystal
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