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

Write ONE application program by using the following requirements: File input an

ID: 666201 • Letter: W

Question

Write ONE application program by using the following requirements:

File input and output (10 points)

Exception handling (10 points)

You can create your own exception classes or

You can using existing exception classes from Java API

Inheritance

At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods (10 points)

At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods (10 points)

At least one interface: this interface needs to have at least two abstract methods (10 points)

At least one method overloading (10 points)

At least one method overriding (10 points)

At least one static member and one static method (10 points)

Polymorphism: you need to have at least one superclass reference to reference objects of a subclass (10 points)

At least one aggregation in a class (10 points)

Within your project, PLEASE include comments

Explanation / Answer

a simple java code for file handling and exception

import java.io.*;

public class test {
   public static void main(String args[]) throws IOException
   {
      FileReader in = null;
      FileWriter out = null;

      try {
         in = new FileReader("input.txt");
         out = new FileWriter("output.txt");
       
         int c;
         while ((c = in.read()) != -1) {
            out.write(c);
         }
      }finally {
         if (in != null) {
            in.close();
         }
         if (out != null) {
            out.close();
         }
      }
   }
}

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