diff --git a/.idea/misc.xml b/.idea/misc.xml index cf9abe6..85c175e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,5 @@ - - + \ No newline at end of file diff --git a/README.md b/README.md index 4d9f4d9..4ee5d94 100644 --- a/README.md +++ b/README.md @@ -51,14 +51,18 @@ Your assignment is to use Built-In java classes to: 1. Look up the latitude and longitude coordinates in any online map you can find via Google. 1. Screenshot the map and add it into the **images** folder of this project. 1. Last add image markdown below this line to load your map image (Hint: Example image Markdown is just a couple lines above this). - + ![ScreenshotMap.png](images%2FScreenshotMap.png) ## PART 3 - Code Scanning and Interpretation * Look at the getHiddenSecrets method and identify the following parts by editing this README.md and providing your answers: - * What is the **access modifer** (e.g. public, private, protected)? - * Is it a **Class method** or an **object Instance method**, how do you know? - * What is its **return data-type**? - * Does it require any **arguments** to call it, and if so, how many **parameters** and of what **data-type**? +1. What is the **access modifer** (e.g. public, private, protected)? + * The method is delcared as public which means it is accessible from outside the class. +2. Is it a **Class method** or an **object Instance method**, how do you know? + * It is a class method because it is declared with the static keyword. +3. What is its **return data-type**? + * The return data type is void which does not return any value. +4. Does it require any **arguments** to call it, and if so, how many **parameters** and of what **data-type**? + * * Scan line by line through the code and try to determine how it works? * What is familiar to you? * What is not familiar to you? diff --git a/images/ScreenshotMap.png b/images/ScreenshotMap.png new file mode 100644 index 0000000..fd9c02c Binary files /dev/null and b/images/ScreenshotMap.png differ diff --git a/src/HiddenSecrets.java b/src/HiddenSecrets.java index 71067b3..54a76d4 100644 --- a/src/HiddenSecrets.java +++ b/src/HiddenSecrets.java @@ -7,7 +7,9 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; - +import java.nio.file.Paths; +import java.util.Scanner; +import java.nio.file.Path; // PUT YOUR IMPORTS HERE public class HiddenSecrets { @@ -39,8 +41,15 @@ public static void getHiddenSecrets(File file) { public static void main(String[] args) { // Put your code to request a file path, // read in a string from System.in, + Scanner scanner = new Scanner(System.in); + System.out.println("Enter the file path: "); + String filePath = scanner.next(); // convert that string into A Path type using Paths class, + Path path = Path.of(filePath); // and call the getHiddenSecrets method to get the file's meta-data + File file = path.toFile(); + getHiddenSecrets(path.toFile()); // HERE + scanner.close(); } }