java make sure the the program works and please follow these

 java  make sure the the program works and  please follow these steps exactly and don\'t use any completed code the simpler the better  1. Create an input file Lab7_1_in.txt with following content:  John 75 82 89 Mary 86 98 79 Rachel 56 65 47 Emily 85 92 79 Andy 62 68 65  2. Write a JAVA Program that will implement two dimensional array. Define the row size as 10 and column size as 10. Define an one dimensional array called name of size of row to store name of students  and two dimensional array called score to store the score of each student in each assignment.  3. Run the program as follow to store your output in a file Lab7_1_out.txt.     java Lab7_1 < Lab7_1_in.txt > Lab7_1_out.txt          4. Your program should read the input file and should show the output as sample output:  ------------------------------------------------- Student Exam 1 Exam 2 Exam 3 Total Percent Grade  ------------------------------------------------- John    75      82      89     246  82.00%   B  Mary    86      98      79     263  87.67%   B  Rachel  56      65      47     168  56.00%   F  Emily   85      92      79     256  85.33%   B  Andy    62      68      65     195  65.00%   D     4. Submit your JAVA file, input file and output file. 

Solution

import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.FileOutputStream;

import java.io.FileReader;

import java.io.IOException;

import java.io.OutputStreamWriter;

import java.io.Writer;

public class Grading {

   public static void main(String[] args) throws IOException {

//       for(int i=0;i<args.length;i++)

//           System.out.println(i+\",\"+args[i]);

      

       String filename = args[0];

       BufferedReader reader = new BufferedReader(new FileReader(filename));

       String line;

       Writer writer = null;

       writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1]), \"utf-8\"));

       writer.write(\"-------------------------------------------------\ \");

       writer.write(\"Student Exam 1 Exam 2 Exam 3 Total Percent Grade\ \");

       writer.write(\"-------------------------------------------------\ \");

       while ((line = reader.readLine()) != null) {

          

           String[] t = line.split(\" \");

           writer.write(t[0] + \"\\t\"+t[1]+\"\\t\"+t[2]+\"\\t\"+t[3]+\"\\t\");

          

           int total = Integer.parseInt(t[1]) + Integer.parseInt(t[2]) + Integer.parseInt(t[3]);

           float percent = (total*100) / 300;

          

          

           int score = (int)percent;

           String grade=\"\";

           if( score>=90 )

               grade =\"A\";

           else if(score>=80)

               grade=\"B\";

           else if(score>=70)

               grade=\"C\";

           else if(score>=60)

               grade=\"D\";

           else if(score>=50)

               grade=\"E\";

           else

               grade=\"F\";

           writer.write(total + \"\\t\"+percent+\"\\t\"+grade+\"\ \");

       }

       reader.close();

       writer.close();

       System.out.println(\"Done!\");

   }

}

John 75 82 89
Mary 86 98 79
Rachel 56 65 47
Emily 85 92 79
Andy 62 68 65

-------------------------------------------------
Student Exam 1 Exam 2 Exam 3 Total Percent Grade
-------------------------------------------------
John   75   82   89   246   82.0   B
Mary   86   98   79   263   87.0   B
Rachel   56   65   47   168   56.0   E
Emily   85   92   79   256   85.0   B
Andy   62   68   65   195   65.0   D

 java make sure the the program works and please follow these steps exactly and don\'t use any completed code the simpler the better 1. Create an input file Lab
 java make sure the the program works and please follow these steps exactly and don\'t use any completed code the simpler the better 1. Create an input file Lab

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site