Page 516 - computer science (868) class 11
P. 516

131                              System.out.println("ERROR: File Not Renamed");
                132                              System.exit(0);

                133                          }
                134                          else

                135                              System.out.println("File Modified SUCCESSFULLY");
                136                          break;

                137                      case 5:
                138                          mat1 = new DataInputStream(new FileInputStream("info.dat"));
                139                          eof = false;

                140                          while(!eof)

                141                          {
                142                              try
                143                              {

                144                                  name = mat1.readUTF();
                145                                  pan = mat1.readUTF();

                146                                  taxIncome = mat1.readDouble();
                147                                  System.out.println("SALARY DETAILS");

                148                                  System.out.println("--------------");
                149                                  System.out.println("Name : "+name);

                150                                  System.out.println("Pan Number : "+pan);
                151                                  System.out.println("TaxIncome : "+taxIncome);

                152                              }
                153                              catch(EOFException e)

                154                              {
                155                                  System.out.println("This is end of File");

                156                                  eof = true;
                157                              }

                158                          }
                159                          mat1.close();

                160                          break;
                161                      case 6:

                162                          System.out.println("Thank You");
                163                          break;
                164                      default: System.out.println("Invalid choice");





                514514  Touchpad Computer Science-XI
   511   512   513   514   515   516   517   518   519   520   521