Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me figure out how to complete this code. I am obviously lost in the

ID: 3823217 • Letter: P

Question

Please help me figure out how to complete this code. I am obviously lost in the world of Java. Thank you!

import java.io.*;
public class FindSelectedFiles
{
public static void main(String[] args)
{
      File f1 = new File("autoexec.bat");
      File f2 = new File("SameFolder.java");
      File f3 = new File("FileStatistics.class");
      File f4 = new File("Hello.java");
      testExists(f1);
      testExists(f2);
      testExists(f3);
//Insert missing code here.
}        
public static void testExists(File f)
{
   System.out.print("File name: " + f.getName() + " ");
   if(f.exists())
       System.out.println("exixts");           
   else
       System.out.println("does not exist");      
}

//Insert missing code here.

Write an applet that you can display in your browser that simulates a marquee by displaying a string of characters one at a time from right to left across the screen. Use the Thread class sleep method to pause momentarily before each new character displays. When the String message is fully displayed, start the message again. Save the applet as Marquee java in the Chapter 17 folder on your Student Disk.

Explanation / Answer

FindSelectedFiles.java

import java.io.*;
public class FindSelectedFiles
{
public static void main(String[] args)
{
File f1 = new File("autoexec.bat");
File f2 = new File("SameFolder.java");
File f3 = new File("FileStatistics.class");
File f4 = new File("Hello.java");
testExists(f1);
testExists(f2);
testExists(f3);
//Insert missing code here.
testExists(f4);

}
public static void testExists(File f)
{
System.out.print("File name: " + f.getName() + " ");
if(f.exists())
System.out.println("exixts");   
else
System.out.println("does not exist");
}
}

Output:

File name: autoexec.bat does not exist
File name: SameFolder.java does not exist
File name: FileStatistics.class does not exist
File name: Hello.java does not exist

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote