Page 366 - Cs_withBlue_J_C11_Flipbook
P. 366

59                      System.out.println(roll+"\t"+name+"\t\t"+avg);
                60                   }  // end of while

                61              } // end of try
                62              catch(EOFException e)

                63              {
                64                   eof=true;  // while loop becomes false

                65              }
                66              // closing stream objects
                67              di.close();

                68              fi.close();

                69           }
                70          // main() method to call other methods
                71          public static void main() throws IOException

                72          {
                73              Result ob=new Result();

                74              ob.createFile();
                75              ob.findAvg();

                76          }
                77      }


              The output of the preceding program is as follows:
              Enter roll no, name, marks in English, Maths and Science
              1 Aadarsh 90 89 93
              Continue y/ny
              Enter roll no, name, marks in English, Maths and Science
              2 Divya 98 99 89

              Continue y/ny
              Enter roll no, name, marks in English, Maths and Science
              2 Priyanshi 89 97 96
              Continue y/nn
              Roll     Name        Average
              --------------------------------------------
              101     Deepak       90.333333333333333
              1       Aadarsh      90.666666666666667
              2       Divya        95.333333333333333
              3       Priyanshi    94.0







                364364  Touchpad Computer Science-XI
   361   362   363   364   365   366   367   368   369   370   371