Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete program to get data from file name DATA.TXT one line at a time

ID: 3627625 • Letter: W

Question

Write a complete program to get data from file name DATA.TXT one line at a time until there is no more data in that file. The following is one sample line in DATA.TXT ( have as many record as you wish in DATA.TXT)
Name SSN quiz mid assignments participation final
LISA 111-11-1111 100 100 100 100 100
Jack 222-22-2222 80 80 100 90 100
Note that the first line is no in DATA.txt.
Your program should create a file name RESULT.txt that reports Name, SSN and a letter grade according to the following rules:
Total= %15 quiz + %15 mid +%40assignments + %10 Participation+ %final
If total >= 90 then A else if total>=80 then B….
You can print same output to screen as well as RESULT.txt.

Explanation / Answer

import java.io.*; class DataApp { public static void main (String[] args) { try { FileInputStream fin = new FileInputStream("DATA.txt"); DataInputStream in = new DataInputStream(fin); BufferedReader r = new BufferedReader(new InputStreamReader(in)); FileWriter fout = new FileWriter("RESULTS.txt"); PrintWriter out = new PrintWriter(fout); String dataLine; while ((dataLine = r.readLine()) != null) { // split the line in DATA.txt into fields separated by whitespace (s) String[] fields = dataLine.split("\s"); int sum = 0; for (int x=2; x
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote