task 7: input/output remade using RandomAccessFile