Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

9 Explain the role of ethics in marketing?

Answered: 1 week ago

Question

\f

Answered: 1 week ago