Page 564 - Cs_withBlue_J_C11_Flipbook
P. 564

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");





                562562  Touchpad Computer Science-XI
   559   560   561   562   563   564   565   566   567   568   569