Convert the C program you wrote in Assignment 1 that decides whether three integers inputted representing a triangle are invalid, equilateral, scalene or isosceles into Java. You should now adapt the program so that it reads the data from a file, the name of which is passed as a parameter on the command line. Your program may assume that this file will always exist and need not verify this. The format of the input file should be of with each of the three side lengths for each triangle written on a single line separated by spaces, for example:
10 20 30
5 5 8
5 5 5
5 8 12
Your program should process the file in batch mode without requiring interaction from the user. Your program should, by default, output the results to the screen. However, if a second parameter is passed on the program's command line then this should be treated as a filename in the current directory where the results should be written to. In this case your program should not output anything to the screen except for potential error messages. Your program should also be as robust as possible in terms of processing the data it receives.




To be honest, I really have no idea what this question is asking but from the help of people in my class I managed to make a start.

 
  Import B102.*;  
 
  class prog3  
  {  
       public static void readInput() 
       {  
       String newline;  
 
         textFile input=new textFile("input.txt",'r');  
         input=new textFile(args[0],'r');  
         while(!input.EOF())  
       {  
       newline=input.readLine();  
       if(line==null)   
                         System.out.println("There are no more numbers to process");  
                         break;  
       System.out.println("The three sides of the triangle are: ",+newline);  
       return(newline);  
         }  
         input.closeFile();  
       }  
 
       public static void check(String *data)
       {  
       int side1,side2,side3,type;  
 
       if ((side1+side2>side3)&&(side1+side3>side2)&&(side2+side3>side1))  
       System.out.println("The triangle is valid");  
         {  
          if ((side1==side2)||(side1==side3)||(side2==side3))  
             if ((side1==side2)&&(side1==side3)) type=2;  
             else type=1;  
            else type=3;  
            return(type);  
         }  
         else System.out.println("Error: Invalid Triangle!");  
       }  
 
 
 
       public static void main(string args[])  
       {  
         int type;  
         char yn;  
         string data;  
 
         System.out.println("This program will select a line of three numbers from a text document, " +   
                            "check that it makes a valid triangle and what type it is");  
         do  
         { System.out.println("Do you wish to continue? [y/n]");  
                 do  
                 { yn=Keybd.in.readChar();  
                   Character.toLowerCase(yn);  
                 }while(!((yn=='y')||(yn=='n')));  
                 if(yn=='y')  
                 {  
                         data=readInput();  
                         type=check(&data);  
 
                         switch (type)  
 {  
 case 1: //A TRIANGLE WITH TWO SIDES EQUAL.  
 System.out.println("Isoceles Triangle!\n");       
 break;  
 
 case 2: //A TRIANGLE WITH ALL SIDES EQUAL.  
 System.out.println("Equilateral triangle!");  
 break;  
 
 case 3://A TRIANGLE WITH ALL SIDES A DIFFERENT LENGTH.  
 System.out.println("This is a Scalene triangle!");  
 }  
                 }  
         }  
         while(yu!='n');  
         return(0);  
       }  
 }


can anybody offer me their advice on their program or tips?