Skip to content

Madame707/Java-Assignment-003

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Assignment-003

Input, Packages, Imports, and a static Method

PART 1 - Build an External Package (JAR short for Java Archive)

A Jar is really just a Zip file with some added Metadata (i.e. data about data). They are organized much the same way file systems are organized, think folders nested in folders with importable Java classes being the files in those folders. So if you have a folder hierarchy like edu/redwoods/cis12 and you had several Java files in the cis12 subfolder named Class1 and Class2 you could Zip it up into a .jar file, import it into your IntelliJ project, and then import those classes like so:

import edu.redwoods.cis12.Class1;
import edu.redwoods.cis12.Class1;

This is a slight over-simplification because you would also have to include a package directive at the top of your Java classes, and you should add additional package metadata, but the comparison is pretty close to reality.

  1. Watch the below linked video, and follow along on how we build a Java Archive artifact (jar) from a GitHub project.
  2. If you didn't already, attempt to build the artifact/jar file while watching the video, try to build the jar file yourself now!
  3. Watch the below linked video, and follow along to import an external jar file into your project!
  4. If your artifact build/creation step was successful, see if you can import your build of the metadata jar file into Java-Assignment-003 after you start PART 2 below!

PART 2 - Implementation

Just like you do every week now!!!

  • Fork my assignment repo
  • Use IntelliJ to clone your fork locally
  • Use IntelliJ to create a local feature branch
  • Complete the following assignment:

Your assignment is to use Built-In java classes to:

  1. Import the following java Built-In classes from the java.nio and java.util packages respectively.
    • java.nio.file.Paths;
      java.util.Scanner;
      java.nio.file.Path;
      
  2. Read a jpg file path from the user.
    • HINT 1: Create a Scanner object instance and use it to read a string.
    • HINT 2: Use Paths class to get a path from your input!
  3. From your path object call a method that converts the file path to a File type object (Cause that's what the provided getHiddenSecret method declares as its parameters).
  4. Pass the file object as an argument to the given getHiddenSecrets method.
  5. Run the program and type in the path for our sample image, and record the GPS coordinates in the output. Ollie the Otter Image
    • HINT: the path can be relative to the project directory, maybe use the string in the example above :-)
  6. Look up the latitude and longitude coordinates in any online map you can find via Google.
  7. Screenshot the map and add it into the images folder of this project.
  8. Last add image markdown below this line to load your map image (Hint: Exa
  9. sample image Markdown is just a couple lines above this).

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)?
      • // Public;
    • Is it a Class method or an object Instance method, how do you know?
      • // It's a Class method because the project declares it public class. The C symbol on the HiddenSecrets project. Also, there nothing that declared an instance method. Class methods can't access instant variables or instance methods.
    • What is its return data-type?
      • // void is the return data type, which has no return value;
    • Does it require any arguments to call it, and if so, how many parameters and of what data-type?
      • // I do see arguements, 3 set of parameters that call a string. The data type is a format specifiers;
  • Scan line by line through the code and try to determine how it works?
    • What is familiar to you?
      • // public class and public static, System.out.println, the strings, ("That file does not exist."); look familiar. The java keyword import declares a class to use in the code; I see the if and statements are conditionals, but i'm not sure what it does yet;
    • What is not familiar to you?
      • // The catch, new, and for statements look new to me;
    • Do the for loops make sense, and if so, tell me what you think they do?
      • // The for loops don't make too much sense to me yet, but from what I lightly researched is; it's a statement written several times;

PART 4 - Turn in

Same as the last 2 Weeks!

  • When completed, use your IDE to Commit and Push your feature branch back to your GitHub Account's fork of Java-Assignment-003.
  • From your GitHub account's feature branch, issue a New Pull request from your feature branch to the instructor's fork
  • Save the Pull Request URL to submit to your Canvas assignment.

About

CIS-12 Java Assignment 003

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages