Write an application that determines whether the first two files are located in the same folder as the third one. The program should prompt the user to provide 3 filepaths. If the files are in the same folder display All files are in the same folder, otherwise display Files are not in the same folder.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

what is wrong with this code?

Safari
File
Edit
View
History
Bookmarks
Window
Help
Wed Nov 17 3:02 PM
delmarlearning.com
Instructions
CompareFolders.java
TestData1.txt
TestData2.txt
TestData3.txt
rtleby
1 import java.nio.file.*;
2 import java.io.IOException;
3 import java.util.Scanner;
his course
Write an application that determines
whether the first two files are located in the
4
same folder as the third one. The program
5 public class CompareFolders{
</>
should prompt the user to provide 3
public static void main(String[] args) {
Scanner input
Path filel
Path file2 = Paths.get("/root/sandbox/TestData2.txt");
Path file3
if(pathl.equals(path2) && path2.equals(path3)){
System.out.println("Files are all in the same folder");
}
else{
System.out.println("Files are not all in the same folder");
}
7
filepaths. If the files are in the same folder
= new Scanner(System.in);
Paths.get ("/root/sandbox/TestDatal.txt");
8
display All files are in the same folder,
%D
A-Z
otherwise display Files are not in the
10
same folder.
11
Paths.get("/root/sandbox/TestData3.txt");
12
Test the program when the files are in the
13
14
oblem. If
same folder and when they are not. The
15
following filepaths can be used to test your
16
program:
17
}
19 }
18
1. /root/sandbox/TestDatal.txt
20
2. /root/sandbox/TestData2.txt
3. /root/sandbox/TestData3.txt
and
/root/sandbox/test/TestData3.t
xt
Grading
Write your Java code in the area on the
right. Use the Run button to compile and
run the code. Clicking the Run Checks
343
NOV
CC
17
ktv
280
go
Transcribed Image Text:Safari File Edit View History Bookmarks Window Help Wed Nov 17 3:02 PM delmarlearning.com Instructions CompareFolders.java TestData1.txt TestData2.txt TestData3.txt rtleby 1 import java.nio.file.*; 2 import java.io.IOException; 3 import java.util.Scanner; his course Write an application that determines whether the first two files are located in the 4 same folder as the third one. The program 5 public class CompareFolders{ </> should prompt the user to provide 3 public static void main(String[] args) { Scanner input Path filel Path file2 = Paths.get("/root/sandbox/TestData2.txt"); Path file3 if(pathl.equals(path2) && path2.equals(path3)){ System.out.println("Files are all in the same folder"); } else{ System.out.println("Files are not all in the same folder"); } 7 filepaths. If the files are in the same folder = new Scanner(System.in); Paths.get ("/root/sandbox/TestDatal.txt"); 8 display All files are in the same folder, %D A-Z otherwise display Files are not in the 10 same folder. 11 Paths.get("/root/sandbox/TestData3.txt"); 12 Test the program when the files are in the 13 14 oblem. If same folder and when they are not. The 15 following filepaths can be used to test your 16 program: 17 } 19 } 18 1. /root/sandbox/TestDatal.txt 20 2. /root/sandbox/TestData2.txt 3. /root/sandbox/TestData3.txt and /root/sandbox/test/TestData3.t xt Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks 343 NOV CC 17 ktv 280 go
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education