Page 556 - ComputerScience_Class_11
P. 556

110                                  pan = mat1.readUTF();
                111                                  taxIncome = mat1.readDouble();
                112                                  String nam = name.toUpperCase();
                113                                  std.writeUTF(name);
                114                                  std.writeUTF(pan);
                115                                  std.writeDouble(taxIncome);

                116                              }
                117
                                                 catch(EOFException e)
                118                              {
                119                                  System.out.println("This is end of File");
                120                                  eof = true;
                121                              }
                122                          }

                123                          mat1.close();
                124                          std.close();
                125                          f1 = new File("info.dat");
                126                          f1.delete();
                127                          f2 = new File("temp.dat");
                128                          Rename = f2.renameTo(f1);
                129                          if(!Rename)
                130                          {
                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);






                  554  Touchpad Computer Science (Ver. 3.0)-XI
   551   552   553   554   555   556   557   558   559   560   561