Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

File Handling

Exercises

 

 

Problem 1: Basic File Handling

 

  Create a file named myFile and write "This is my first file in java"
  Open the file and print the contents

 

Problem 2: Cryptography

 
  Develop a text file containing the following
 
    The instructor has ordered the following books on this subject - they are now in the
    library: Web Hacking by McClure(Addison-Wesley), Computer Security by Bishop
    (Addison-Wesley), Cryptography for Internet and Database Applications by
    Galgreath (Wiley), Network Security by Maiwald (Osborne), Cryptography by Mel
    and Baker (Addison-Wesley), Crypto by Levy (Viking), Code Breaking by Kipenhahn
    (Overlook Press). More are on order.
 
  Develop an application as described below. Assume that you are the code developer
    and that program is being used to debug. You will know, therefore, the amount of
    the shift (described below) etc.
 
        Prompt the user for the name-location of the file with the contents as described above.
        Prompt the user for the encryption process to use: Give the user choices of Caesar's
       Shift and two others. You pick the others (place comments at beginning of code
       to describe the ones you pick). They must be more sophisticated (more difficult to
       break) than the Caesar's shift. For the Caesar's shift, also prompt the user for the
       number of spaces to shift.
       Open the file described above and encrypt it to three separate files, one for
       each encryption method chosen.
       Open each of the encrypted files and recover each to the original file, each with
       a separate name.
 
  Turn in a copy of:
 
       All code.
       The original file - appropriately labeled (by code).
       Each encrypted file - appropriately labeled (by code).
       Each recovered file - appropriately labeled (by code).