(Can be found in code directory as an png) Explanation of the Code: Functionality: This code implements a desktop application for moving files with optional features like encryption and hiding. Users can select a source directory, a destination directory, and choose which files to move based on extensions (all files, txt, pdf, png). They can also choose to encrypt filenames and hide them in the destination directory. Logic Flow: 1. Initialization: о The GUI is created with labels, text fields, checkboxes, radio buttons, and a button. 2. User Interaction: User enters source and destination directory paths. User selects file types to move (all or specific extensions). User chooses encryption and hiding options (optional). User clicks the "MOVE" button. 3. File Moving: The code checks if both source and destination directories exist. о о It creates a file filter based on the selected file types. It retrieves a list of files to move from the source directory using the filter. For each file: The filename is optionally encrypted (not fully implemented). A compressed filename is created (optional, not implemented). A hidden filename is created by prepending a dot (.).

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter13: File Input And Output
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Dear students,
your first homework is about writing ten assertion cases (at least with 5 different ypes of assertion
statements) (two-student groups will have 20 assertion cases) from your software projects. (50 points).
Two test suits will be implemented (you will/can use assertions you have written before). (20 points)
Do not write redundant cases, please.
You will present the project with your group members (2 student groups) or individually.
You will present your homework in no more than 5-10 minutes.
I need to see the UML class diagrams of your project first shortly. (20 points)
A parameterized test must be in your homework, please. (10 points)

 

 

PROJECTS TOPİC IS WRITTEN IN THE IMAGE FOLLOW THE IMAGE

WE HAVE FOUND THE PROJECT AND THE CODES ARE IN THE BELOW IMAGE CAN YOU WRITE 10 MORE ASSERTION CASES PLEASE 

 

Pseudocode
// Main class with GUI and file moving functionality
FUNCTION actionPerformed(ActionEvent e)
 // Get user input
 sourceDir = sourceDirTextField.getText()
 destDir = destDirTextField.getText()
 isEncrypt = encryptRadioButton.isSelected()
 isCompress = compressRadioButton.isSelected()
 isHide = hideRadioButton.isSelected()
 // Validate directories
 IF sourceDir is not a directory OR destDir is not a directory
 DISPLAY error message
 RETURN
 // Create file filter based on user selection
 fileFilter = (File file) ->
 IF allFilesCheckBox.isSelected()
 RETURN TRUE
 ELSE
 fileName = file.getName()
 fileExtension = GET_FILE_EXTENSION(fileName)
 IF txtCheckBox.isSelected() AND fileExtension EQUALS "txt"
 RETURN TRUE
 ELSE IF pdfCheckBox.isSelected() AND fileExtension EQUALS "pdf"
 RETURN TRUE
 ELSE IF pngCheckBox.isSelected() AND fileExtension EQUALS "png"
 RETURN TRUE
 ELSE
 RETURN FALSE
 // Get list of files to move
 filesToMove = sourceDirectory.listFiles(fileFilter)
 IF filesToMove is empty
 DISPLAY message that no files were found
 RETURN
 // Iterate through files and move them
 FOR EACH file IN filesToMove
 fileName = file.getName()
 fileExtension = GET_FILE_EXTENSION(fileName)
 // Optional encryption (incomplete implementation)
 encryptedFileName = IF isEncrypt THEN encryptFileName(fileName) ELSE fileName
 // Optional compression (not implemented)
 compressedFileName = IF isCompress THEN COMPRESS_FILENAME(encryptedFileName)
ELSE encryptedFileName
 // Create hidden filename
 hiddenFileName = IF isHide THEN "." + compressedFileName ELSE compressedFileName
 destinationFile = new File(destDir, hiddenFileName)
 IF destinationFile does not exist
 // Copy file to destination
 COPY file to destinationFile
 DISPLAY success message for fileName
 ELSE
 DISPLAY message that file already exists
// Function to get file extension
FUNCTION GET_FILE_EXTENSION(fileName)
 dotIndex = fileName.lastIndexOf(".")
 IF dotIndex > 0 AND dotIndex < fileName.length() - 1
 RETURN fileName.substring(dotIndex + 1)
 ELSE
 RETURN ""
// Function to encrypt filename (incomplete implementation)
FUNCTION encryptFileName(fileName)
 secretKey = "secretKey"
 key = secretKey.getBytes("UTF-8")
 sha = MessageDigest.getInstance("SHA-1")
 key = sha.digest(key)
 key = Arrays.copyOf(key, 16)
 secretKeySpec = new SecretKeySpec(key, "AES")
 cipher = Cipher.getInstance("AES")
 cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec)
 // Missing: Actual encryption logic using cipher.doFinal()
 // Return empty string as the encryption is incomplete
 RETURN ""
// Function to compress filename (not implemented)
FUNCTION COMPRESS_FILENAME(fileName)
 // Optional implementation for compressing the filename
 // Can use a library like Apache Commons Compress
 RETURN fileName + ".zip"
// Function to convert bytes to hex string
FUNCTION bytesToHex(bytes)
 result = StringBuilder()
 FOR EACH byte IN bytes
 result.append(Integer.toString((byte & 0xff) + 0x100, 16).substring(1))
 RETURN result.toString()

(Can be found in code directory as an png)
Explanation of the Code:
Functionality:
This code implements a desktop application for moving files with optional features like encryption
and hiding. Users can select a source directory, a destination directory, and choose which files to
move based on extensions (all files, txt, pdf, png). They can also choose to encrypt filenames and
hide them in the destination directory.
Logic Flow:
1. Initialization:
о The GUI is created with labels, text fields, checkboxes, radio buttons, and a button.
2. User Interaction:
User enters source and destination directory paths.
User selects file types to move (all or specific extensions).
User chooses encryption and hiding options (optional).
User clicks the "MOVE" button.
3. File Moving:
The code checks if both source and destination directories exist.
о
о
It creates a file filter based on the selected file types.
It retrieves a list of files to move from the source directory using the filter.
For each file:
The filename is optionally encrypted (not fully implemented).
A compressed filename is created (optional, not implemented).
A hidden filename is created by prepending a dot (.).
Transcribed Image Text:(Can be found in code directory as an png) Explanation of the Code: Functionality: This code implements a desktop application for moving files with optional features like encryption and hiding. Users can select a source directory, a destination directory, and choose which files to move based on extensions (all files, txt, pdf, png). They can also choose to encrypt filenames and hide them in the destination directory. Logic Flow: 1. Initialization: о The GUI is created with labels, text fields, checkboxes, radio buttons, and a button. 2. User Interaction: User enters source and destination directory paths. User selects file types to move (all or specific extensions). User chooses encryption and hiding options (optional). User clicks the "MOVE" button. 3. File Moving: The code checks if both source and destination directories exist. о о It creates a file filter based on the selected file types. It retrieves a list of files to move from the source directory using the filter. For each file: The filename is optionally encrypted (not fully implemented). A compressed filename is created (optional, not implemented). A hidden filename is created by prepending a dot (.).
Expert Solution
steps

Step by step

Solved in 1 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
CMPTR
CMPTR
Computer Science
ISBN:
9781337681872
Author:
PINARD
Publisher:
Cengage